Skip to content

Commit c55f097

Browse files
author
MacBookAirM2
committed
add log storage
1 parent 575d7ee commit c55f097

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

conf/zinx.json

-12
This file was deleted.

zutils/witer.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package zutils
33
import (
44
"bufio"
55
"bytes"
6+
"fmt"
67
"io"
78
"os"
89
"path/filepath"
@@ -52,7 +53,11 @@ func New(path string) *Writer {
5253
}
5354
w.maxSize = sizeMiB * defMaxSize
5455
w.maxAge = defMaxAge
55-
os.MkdirAll(filepath.Dir(w.fpath), 0755)
56+
err := os.MkdirAll(filepath.Dir(w.fpath), 0755)
57+
if err != nil {
58+
fmt.Printf("%c[%d;%d;%dm%s%c[0m", 0x1B, 0, 40, 31, fmt.Sprintf("create log file error %-v", err), 0x1B)
59+
return nil
60+
}
5661
go w.daemon()
5762
return w
5863
}

0 commit comments

Comments
 (0)