|
|
|
@ -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
|
|
|
|
|