Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/log/logger_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@

func SetConsoleLogger(loggerName, writerName string, level Level) {
writer := NewEventWriterConsole(writerName, WriterMode{
Level: level,

Check failure on line 80 in modules/log/logger_global.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gci)

Check failure on line 80 in modules/log/logger_global.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gci)

Check failure on line 80 in modules/log/logger_global.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gci)
Flags: FlagsFromBits(LstdFlags),
Colorize: CanColorStdout,
WriterOption: WriterConsoleOption{},
// Stderr must be true: this logger is installed early (app.Before), before subcommands
// like "dump" redirect logging to stderr. If set to false, log output goes to stdout and
// corrupts any command that writes data to stdout (e.g. "gitea dump --file -").
// It is inconsistent with the default console logger (which will be initialized later and might use Stdout by default),
// but there is no other way than this patch at the moment.
WriterOption: WriterConsoleOption{Stderr: true},
Comment thread
wxiaoguang marked this conversation as resolved.
})
GetManager().GetLogger(loggerName).ReplaceAllWriters(writer)
}
Loading