Enable loss less rotation of log files
This commit is contained in:
parent
0a0cf87625
commit
cf387d5a6d
5 changed files with 175 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue