Skip to content

Commit

Permalink
add log storage
Browse files Browse the repository at this point in the history
  • Loading branch information
MacBookAirM2 committed May 10, 2023
1 parent 575d7ee commit c55f097
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
12 changes: 0 additions & 12 deletions conf/zinx.json

This file was deleted.

7 changes: 6 additions & 1 deletion zutils/witer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package zutils
import (
"bufio"
"bytes"
"fmt"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -52,7 +53,11 @@ func New(path string) *Writer {
}
w.maxSize = sizeMiB * defMaxSize
w.maxAge = defMaxAge
os.MkdirAll(filepath.Dir(w.fpath), 0755)
err := os.MkdirAll(filepath.Dir(w.fpath), 0755)
if err != nil {
fmt.Printf("%c[%d;%d;%dm%s%c[0m", 0x1B, 0, 40, 31, fmt.Sprintf("create log file error %-v", err), 0x1B)
return nil
}
go w.daemon()
return w
}
Expand Down

0 comments on commit c55f097

Please sign in to comment.