chore: only use one log file (close #1116)
This commit is contained in:
parent
7e7369dbc4
commit
969042b001
@ -19,9 +19,6 @@ const (
|
||||
loggerError = "ERR"
|
||||
)
|
||||
|
||||
const maxLogCount = 1000000
|
||||
|
||||
var logCount int
|
||||
var setupLogLock sync.Mutex
|
||||
var setupLogWorking bool
|
||||
|
||||
@ -96,9 +93,7 @@ func logHelper(ctx context.Context, level string, msg string) {
|
||||
id := ctx.Value(RequestIdKey)
|
||||
now := time.Now()
|
||||
_, _ = fmt.Fprintf(writer, "[%s] %v | %s | %s \n", level, now.Format("2006/01/02 - 15:04:05"), id, msg)
|
||||
logCount++ // we don't need accurate count, so no lock here
|
||||
if logCount > maxLogCount && !setupLogWorking {
|
||||
logCount = 0
|
||||
if !setupLogWorking {
|
||||
setupLogWorking = true
|
||||
go func() {
|
||||
SetupLogger()
|
||||
|
Loading…
Reference in New Issue
Block a user