From 969042b0017c9698b9febe66b430d9b4fe436166 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 10 Mar 2024 23:44:48 +0800 Subject: [PATCH] chore: only use one log file (close #1116) --- common/logger/logger.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/logger/logger.go b/common/logger/logger.go index 8232b2fc..41b98ca3 100644 --- a/common/logger/logger.go +++ b/common/logger/logger.go @@ -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()