modify NewLogger, add example
This commit is contained in:
parent
bcd0f31019
commit
f95dfe1666
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue