mirror of
https://github.com/cubixle/groxy.git
synced 2026-04-24 22:54:43 +01:00
init
This commit is contained in:
28
internal/logging/logging.go
Normal file
28
internal/logging/logging.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func Logger() *zap.Logger {
|
||||
// info level enabler
|
||||
level := zap.LevelEnablerFunc(func(level zapcore.Level) bool {
|
||||
return level == zapcore.DebugLevel
|
||||
})
|
||||
|
||||
// write syncers
|
||||
stdoutSyncer := zapcore.Lock(os.Stdout)
|
||||
|
||||
core := zapcore.NewTee(
|
||||
zapcore.NewCore(
|
||||
zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()),
|
||||
stdoutSyncer,
|
||||
level,
|
||||
),
|
||||
)
|
||||
|
||||
return zap.New(core)
|
||||
}
|
||||
Reference in New Issue
Block a user