diff --git a/logger.go b/logger.go index 40693b0..a5c307a 100644 --- a/logger.go +++ b/logger.go @@ -42,7 +42,8 @@ var ( type logger struct { *zap.Logger - Config *LoggerConfig + 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