Logger: pre-create log files before lumberjack does
Clunky workaround for https://github.com/natefinch/lumberjack/issues/164
This commit is contained in:
parent
03c6f92a5f
commit
47e6a56b16
|
@ -22,6 +22,11 @@ func Logger(logMaxSize int, logMaxAge int, logMaxBackups int, fileName string) i
|
||||||
}
|
}
|
||||||
return fp
|
return fp
|
||||||
}
|
}
|
||||||
|
if fp, err := os.OpenFile(fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644); err == nil {
|
||||||
|
fp.Close()
|
||||||
|
} else {
|
||||||
|
dlog.Errorf("Unable to create [%v]: [%v]", fileName, err)
|
||||||
|
}
|
||||||
logger := &lumberjack.Logger{
|
logger := &lumberjack.Logger{
|
||||||
LocalTime: true,
|
LocalTime: true,
|
||||||
MaxSize: logMaxSize,
|
MaxSize: logMaxSize,
|
||||||
|
|
Loading…
Reference in New Issue