master v1.0.4
杨赟 1 year ago
parent c13cc3677a
commit 26c63ead48

@ -43,6 +43,7 @@ var (
type logger struct {
*zap.Logger
Config *LoggerConfig
hasShowLine bool
}
type LoggerConfig struct {
@ -161,7 +162,8 @@ func (l *logger) getWriteSyncer(filename string) (zapcore.WriteSyncer, error) {
path.Join(l.Config.Director, filename+".%Y-%m-%d.log"),
options...,
)
if l.Config.LogInConsole {
if l.Config.LogInConsole && !l.hasShowLine {
l.hasShowLine = true
return zapcore.NewMultiWriteSyncer(zapcore.AddSync(os.Stdout), zapcore.AddSync(fileWriter)), err
}
return zapcore.AddSync(fileWriter), err

Loading…
Cancel
Save