Skip to content

Commit 7b3c2e1

Browse files
thtclaude
andcommitted
fix: redirect early CLI console logger to stderr
When running `gitea dump` with output routed to stdout (--file -), deprecation warnings from loadAvatarsFrom were written to stdout, corrupting the archive stream. Root cause: PrepareConsoleLoggerLevel (called in app.Before) sets up a console logger via SetConsoleLogger, which used WriterConsoleOption{} defaulting Stderr to false (i.e. stdout). This logger is installed before the dump subcommand can redirect logging to stderr in runDump. Fix: use WriterConsoleOption{Stderr: true} in SetConsoleLogger so all early CLI diagnostic output goes to stderr from the start. This is correct for all subcommands — diagnostic/log output should never pollute stdout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6b8dd90 commit 7b3c2e1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

modules/log/logger_global.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func SetConsoleLogger(loggerName, writerName string, level Level) {
8080
Level: level,
8181
Flags: FlagsFromBits(LstdFlags),
8282
Colorize: CanColorStdout,
83-
WriterOption: WriterConsoleOption{},
83+
WriterOption: WriterConsoleOption{Stderr: true},
8484
})
8585
GetManager().GetLogger(loggerName).ReplaceAllWriters(writer)
8686
}

0 commit comments

Comments
 (0)