Browse Source

perf: avoid exposure of zapcore

dev
Dnomd343 5 months ago
parent
commit
506ad861fe
  1. 6
      logger/interface.go

6
logger/interface.go

@ -5,6 +5,8 @@ import (
"io" "io"
) )
type Level = zapcore.Level
const ( const (
DebugLevel = zapcore.DebugLevel DebugLevel = zapcore.DebugLevel
InfoLevel = zapcore.InfoLevel InfoLevel = zapcore.InfoLevel
@ -34,13 +36,13 @@ func Panicf(template string, args ...interface{}) {
} }
// GetLevel return the current logger level. // GetLevel return the current logger level.
func GetLevel() zapcore.Level { func GetLevel() Level {
return logger.level.Level() return logger.level.Level()
} }
// SetLevel configure logger output level. Note that debug level will output // SetLevel configure logger output level. Note that debug level will output
// more information and reduce performance. // more information and reduce performance.
func SetLevel(level zapcore.Level) { func SetLevel(level Level) {
logger.level.SetLevel(level) logger.level.SetLevel(level)
if level == DebugLevel { if level == DebugLevel {
logger.verbose = true logger.verbose = true

Loading…
Cancel
Save