-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the default console logger when it is not set in the configuration #602
Changes from 3 commits
eb09b63
3749eaf
e22626d
b6ca28d
c39918c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -867,6 +867,16 @@ func newLogService() { | |
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",") | ||
LogConfigs = make([]string, len(LogModes)) | ||
|
||
useConsole := false | ||
for _, mode := range LogModes { | ||
if mode == "console" { | ||
useConsole = true | ||
} | ||
} | ||
if (!useConsole) { | ||
log.DelLogger("console") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this implementation, we always add the console logger ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that is correct, was thinking about setting the log level earlier but then you could miss some information about where the custom log file is read from |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if !useConsole {
log.DelLogger("console")
} |
||
|
||
for i, mode := range LogModes { | ||
mode = strings.TrimSpace(mode) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly cleaner :)