Skip to content

Commit 48c163a

Browse files
committed
fix small issue where checkrr doesn't notify about last resort logger
1 parent 012093c commit 48c163a

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

logging/log_unix.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ func (logger *Log) FromConfig(conf *koanf.Koanf) {
2828
logger.config = conf
2929
if conf != nil {
3030
logKeys := conf.Keys()
31+
if len(logKeys) == 0 {
32+
message := logger.Localizer.MustLocalize(&i18n.LocalizeConfig{
33+
MessageID: "LogLastResortOnly",
34+
})
35+
logger.LastResort.Warn(message)
36+
logger.loggers = append(logger.loggers, logger.LastResort)
37+
}
3138
for _, key := range logKeys {
3239
k := strings.Split(key, ".")[0]
3340
config := conf.Cut(k)

logging/log_windows.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ func (logger *Log) FromConfig(conf *koanf.Koanf) {
2626
logger.config = conf
2727
if conf != nil {
2828
logKeys := conf.Keys()
29+
if len(logKeys) == 0 {
30+
message := logger.Localizer.MustLocalize(&i18n.LocalizeConfig{
31+
MessageID: "LogLastResortOnly",
32+
})
33+
logger.LastResort.Warn(message)
34+
logger.loggers = append(logger.loggers, logger.LastResort)
35+
}
2936
for _, key := range logKeys {
3037
k := strings.Split(key, ".")[0]
3138
config := conf.Cut(k)

0 commit comments

Comments
 (0)