put the default logger format and feature toggle to fallback to old logger (#47584)

This commit is contained in:
ying-jeanne 2022-04-13 11:02:19 +02:00 committed by GitHub
parent 232d880fe0
commit 06d2d44031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,7 +446,9 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error {
} }
var err error var err error
root.gokitLogActivated, err = isNewLoggerActivated(cfg) isOldLoggerActivated, err := isOldLoggerActivated(cfg)
root.gokitLogActivated = !isOldLoggerActivated
if err != nil { if err != nil {
return err 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. // This would be removed eventually, no need to make a fancy design.
// For the sake of important cycle I just copied the function // 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") section := cfg.Section("feature_toggles")
toggles, err := readFeatureTogglesFromInitFile(section) toggles, err := readFeatureTogglesFromInitFile(section)
if err != nil { if err != nil {
return false, err return false, err
} }
return toggles["newlog"], nil return toggles["oldlog"], nil
} }
func readFeatureTogglesFromInitFile(featureTogglesSection *ini.Section) (map[string]bool, error) { func readFeatureTogglesFromInitFile(featureTogglesSection *ini.Section) (map[string]bool, error) {