From c3e4bb80a80cce18e8fc08eaa1ca0bddc4c8ce7f Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Fri, 20 Jan 2023 12:52:22 +0100 Subject: [PATCH] Other: Fix MaxLogs off-by-one limit and bump limit to 10 --- internal/logging/logging.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/logging/logging.go b/internal/logging/logging.go index ad34762c..90331c02 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -43,7 +43,7 @@ const ( MaxLogSize = 5 * 1024 * 1024 // MaxLogs defines how many log files should be kept. - MaxLogs = 3 + MaxLogs = 10 ) type coloredStdOutHook struct { @@ -92,8 +92,7 @@ func Init(logsPath, level string) error { logrus.AddHook(newColoredStdOutHook()) rotator, err := NewRotator(MaxLogSize, func() (io.WriteCloser, error) { - // Leaving MaxLogs-1 since new log file will be opened right away. - if err := clearLogs(logsPath, MaxLogs-1, MaxLogs); err != nil { + if err := clearLogs(logsPath, MaxLogs, MaxLogs); err != nil { return nil, err }