ing
This commit is contained in:
parent
93f396a433
commit
cb473141c2
10
log.go
10
log.go
|
@ -8,9 +8,9 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logger *zap.Logger
|
var logger *zap.SugaredLogger
|
||||||
|
|
||||||
func Logger() *zap.Logger {
|
func Logger() *zap.SugaredLogger {
|
||||||
if nil == logger {
|
if nil == logger {
|
||||||
log.Panicf("Initialize Logger first to use Logger")
|
log.Panicf("Initialize Logger first to use Logger")
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,15 @@ func InitializeLogger(configPath string) error {
|
||||||
if _logger, err = zap.NewDevelopment(); nil != err {
|
if _logger, err = zap.NewDevelopment(); nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger = _logger
|
logger = _logger.Sugar()
|
||||||
logger.Info("Logger has been initialized as development mode")
|
logger.Infof("Logger has been initialized as development mode")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if _logger, err = cfg.Build(); nil != err {
|
if _logger, err = cfg.Build(); nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger = _logger
|
logger = _logger.Sugar()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user