Reverse the coupling of module log and config #1606

Merged
konrad merged 9 commits from HoffmannP/api:main into main 2023-10-03 09:28:34 +00:00
2 changed files with 10 additions and 2 deletions
Showing only changes of commit 5560fc7f98 - Show all commits

View File

@ -68,7 +68,11 @@ func ConfigLogger(configLogEnabled bool, configLogStandard string, configLogPath
// The backend is the part which actually handles logging the log entries somewhere.
var backend logging.Backend
backend = &NoopBackend{}
if configLogEnabled && configLogStandard != "off" && configLogStandard != "false" {
if configLogStandard == "false" {
configLogStandard = "off"
Warning("log.standard value 'false' is deprecated and will be removed in a future release. Please use the value 'off'.")
}
if configLogEnabled && configLogStandard != "off" {
logBackend := logging.NewLogBackend(GetLogWriter(configLogStandard, "standard"), "", 0)
backend = logging.NewBackendFormatter(logBackend, logging.MustStringFormatter(Fmt+"\n"))
}

View File

@ -47,7 +47,11 @@ func NewWatermillLogger(configLogEnabled bool, configLogEvents string, configLog
var backend logging.Backend
backend = &NoopBackend{}
if configLogEnabled && configLogEvents != "off" && configLogEvents != "false" {
if configLogEvents == "false" {
configLogEvents = "off"
Warning("log.events value 'false' is deprecated and will be removed in a future release. Please use the value 'off'.")
}
if configLogEnabled && configLogEvents != "off" {
logBackend := logging.NewLogBackend(GetLogWriter(configLogEvents, "events"), "", 0)
backend = logging.NewBackendFormatter(logBackend, logging.MustStringFormatter(watermillFmt+"\n"))
}