Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalcaliskan committed Sep 23, 2021
2 parents e347e87 + 119bde1 commit 6af0670
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
32 changes: 17 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: git://github.com/dnephin/pre-commit-golang
rev: v0.4.0
hooks:
- id: go-fmt
- id: go-imports
- id: golangci-lint
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
- id: go-mod-vendor
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: git://github.com/dnephin/pre-commit-golang
rev: v0.4.0
hooks:
- id: go-mod-vendor
- id: go-fmt
- id: go-imports
- id: validate-toml
- id: golangci-lint
- id: go-unit-tests
- id: go-build
- id: go-mod-tidy
28 changes: 19 additions & 9 deletions internal/logging/logging.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
package logging

import "go.uber.org/zap"

var (
logger *zap.Logger
err error
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"os"
)

var logger *zap.Logger

func init() {
logger, err = zap.NewProduction()
if err != nil {
panic(err)
cfgConsole := zapcore.EncoderConfig{
MessageKey: "message",
LevelKey: "severity",
EncodeLevel: zapcore.LowercaseLevelEncoder,
TimeKey: "time",
EncodeTime: zapcore.RFC3339TimeEncoder,
CallerKey: "caller",
EncodeCaller: zapcore.FullCallerEncoder,
}

core := zapcore.NewTee(zapcore.NewCore(zapcore.NewJSONEncoder(cfgConsole), zapcore.Lock(os.Stdout), zap.InfoLevel))
logger = zap.New(core)
logger.Info("An info level message")
}

// GetLogger returns the common *zap.Logger
// GetLogger returns the shared *zap.Logger
func GetLogger() *zap.Logger {
return logger
}

0 comments on commit 6af0670

Please sign in to comment.