From 06d2d44031b23930f5fc2ab3bf5dcd63d6de40b6 Mon Sep 17 00:00:00 2001 From: ying-jeanne <74549700+ying-jeanne@users.noreply.github.com> Date: Wed, 13 Apr 2022 11:02:19 +0200 Subject: [PATCH] put the default logger format and feature toggle to fallback to old logger (#47584) --- pkg/infra/log/log.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/infra/log/log.go b/pkg/infra/log/log.go index ea3b824388d..efe85bbf84e 100644 --- a/pkg/infra/log/log.go +++ b/pkg/infra/log/log.go @@ -446,7 +446,9 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error { } var err error - root.gokitLogActivated, err = isNewLoggerActivated(cfg) + isOldLoggerActivated, err := isOldLoggerActivated(cfg) + root.gokitLogActivated = !isOldLoggerActivated + if err != nil { return err } @@ -459,13 +461,13 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error { // This would be removed eventually, no need to make a fancy design. // For the sake of important cycle I just copied the function -func isNewLoggerActivated(cfg *ini.File) (bool, error) { +func isOldLoggerActivated(cfg *ini.File) (bool, error) { section := cfg.Section("feature_toggles") toggles, err := readFeatureTogglesFromInitFile(section) if err != nil { return false, err } - return toggles["newlog"], nil + return toggles["oldlog"], nil } func readFeatureTogglesFromInitFile(featureTogglesSection *ini.Section) (map[string]bool, error) {