Do not quite on flush error

This commit is contained in:
Leonid Bugaev
2016-08-02 12:55:02 +03:00
parent 25b998fa3f
commit e38f6a5801
+8
View File
@@ -8,6 +8,7 @@ import (
"log"
"os"
"path/filepath"
"runtime/debug"
"sort"
"strconv"
"strings"
@@ -208,6 +209,13 @@ func (o *FileOutput) Write(data []byte) (n int, err error) {
}
func (o *FileOutput) flush() {
// Don't exit on panic
defer func() {
if r := recover(); r != nil {
log.Println("PANIC while file flush: ", r, o, string(debug.Stack()))
}
}()
defer o.mu.Unlock()
o.mu.Lock()