modify NewLogger, add example

This commit is contained in:
wangjian 2022-08-02 15:29:11 +08:00
parent bcd0f31019
commit f95dfe1666
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ type Logger struct {
initialized bool initialized bool
} }
func NewLogger(mod ...ModOptions) *zap.Logger { func NewLogger(mod ...ModOptions) *Logger {
logger = &Logger{} logger = &Logger{}
logger.Lock() logger.Lock()
defer logger.Unlock() defer logger.Unlock()
@ -90,7 +90,7 @@ func NewLogger(mod ...ModOptions) *zap.Logger {
logger.zapConfig.Level.SetLevel(logger.Opts.Level) logger.zapConfig.Level.SetLevel(logger.Opts.Level)
logger.init() logger.init()
logger.initialized = true logger.initialized = true
return logger.Logger return logger
} }
func (logger *Logger) init() { func (logger *Logger) init() {