修复不需要日志时, NPE问题
This commit is contained in:
parent
520bf437cd
commit
9c51e86e3a
@ -97,6 +97,9 @@ func getLogInstance(logConf *LogConfig, loggerInstance *zap.Logger) (*zap.Logger
|
|||||||
if nil != loggerInstance {
|
if nil != loggerInstance {
|
||||||
return loggerInstance, nil
|
return loggerInstance, nil
|
||||||
}
|
}
|
||||||
|
if nil == logConf {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
logConfList := []logger.SetLoggerOptionFunc{logger.WithEncoder(logConf.Encoder), logger.WithCallerSkip(logConf.Skip), logger.WithCaller()}
|
logConfList := []logger.SetLoggerOptionFunc{logger.WithEncoder(logConf.Encoder), logger.WithCallerSkip(logConf.Skip), logger.WithCaller()}
|
||||||
if logConf.ConsoleOutput {
|
if logConf.ConsoleOutput {
|
||||||
logConfList = append(logConfList, logger.WithConsoleOutput())
|
logConfList = append(logConfList, logger.WithConsoleOutput())
|
||||||
|
Loading…
Reference in New Issue
Block a user