Enable loss less rotation of log files

This commit is contained in:
Marco Jantke 2017-09-15 15:02:03 +02:00 committed by Traefiker
parent 0a0cf87625
commit cf387d5a6d
5 changed files with 175 additions and 5 deletions

View file

@ -227,8 +227,10 @@ func RotateFile() error {
return nil
}
if err := CloseFile(); err != nil {
return fmt.Errorf("error closing log file: %s", err)
if logFile != nil {
defer func(f *os.File) {
f.Close()
}(logFile)
}
if err := OpenFile(logFilePath); err != nil {