diff --git a/matterbridge.go b/matterbridge.go index 145ce68c..6d40e423 100644 --- a/matterbridge.go +++ b/matterbridge.go @@ -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() + } } }()