Check f.Sync() errors before closing logfile
This commit is contained in:
@@ -54,8 +54,9 @@ func main() {
|
||||
// if logging to a file, ensure it is closed when the program terminates
|
||||
defer func() {
|
||||
if f, ok := rootLogger.Out.(*os.File); ok {
|
||||
f.Sync()
|
||||
f.Close()
|
||||
if err := f.Sync(); err != nil {
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user