From 3b533a501f988fc28ab58bfe0f80c4a3b69b029f Mon Sep 17 00:00:00 2001 From: Ben Brooks Date: Thu, 23 May 2024 13:46:01 +0100 Subject: [PATCH] fix panic for nil rotationTicker --- base/logger_file.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/logger_file.go b/base/logger_file.go index 0117a13a0c..6b439f2f8c 100644 --- a/base/logger_file.go +++ b/base/logger_file.go @@ -233,7 +233,9 @@ func (lfc *FileLoggerConfig) init(ctx context.Context, level LogLevel, name stri WarnfCtx(ctx, "Panic when deleting rotated log files: %s\n%s", panicked, debug.Stack()) } }() - defer rotationTicker.Stop() + if rotationTicker != nil { + defer rotationTicker.Stop() + } defer logDeletionTicker.Stop() for { select {