[client] Fix duplicate log lines in containers (#5609)

This commit is contained in:
Viktor Liu
2026-03-19 22:53:05 +08:00
committed by GitHub
parent a1858a9cb7
commit 5ffaa5cdd6
2 changed files with 7 additions and 1 deletions

View File

@@ -43,7 +43,13 @@ func InitLogger(logger *log.Logger, logLevel string, logs ...string) error {
var writers []io.Writer
logFmt := os.Getenv("NB_LOG_FORMAT")
seen := make(map[string]bool, len(logs))
for _, logPath := range logs {
if seen[logPath] {
continue
}
seen[logPath] = true
switch logPath {
case LogSyslog:
AddSyslogHookToLogger(logger)