Skip to content

Commit a1be041

Browse files
authored
log: fix panic when InitLogger failed (pingcap#239)
1 parent c1ba82a commit a1be041

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/log/log.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,16 @@ func InitLogger(cfg *Config) error {
8989
MaxBackups: cfg.FileMaxBackups,
9090
},
9191
})
92+
if err != nil {
93+
return err
94+
}
95+
9296
// Do not log stack traces at all, as we'll get the stack trace from the
9397
// error itself.
9498
appLogger = Logger{logger.WithOptions(zap.AddStacktrace(zap.DPanicLevel))}
9599
appLevel = props.Level
96100

97-
return err
101+
return nil
98102
}
99103

100104
// With creates a child logger from the global logger and adds structured

0 commit comments

Comments
 (0)