From 5361949a13aa1341d6e9b37aea0d66f14ff2741c Mon Sep 17 00:00:00 2001 From: Grant Murphy Date: Tue, 23 Jan 2018 10:02:20 +1000 Subject: [PATCH] Sending log messages to multiple streams Use the configured logger for all log messages. --- cmd/gas/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/gas/main.go b/cmd/gas/main.go index 5a04c02..68a6277 100644 --- a/cmd/gas/main.go +++ b/cmd/gas/main.go @@ -125,19 +125,19 @@ func loadConfig(configFile string) (gas.Config, error) { func loadRules(include, exclude string) rules.RuleList { var filters []rules.RuleFilter if include != "" { - log.Printf("including rules: %s", include) + logger.Printf("including rules: %s", include) including := strings.Split(include, ",") filters = append(filters, rules.NewRuleFilter(false, including...)) } else { - log.Println("including rules: default") + logger.Println("including rules: default") } if exclude != "" { - log.Printf("excluding rules: %s", exclude) + logger.Printf("excluding rules: %s", exclude) excluding := strings.Split(exclude, ",") filters = append(filters, rules.NewRuleFilter(true, excluding...)) } else { - log.Println("excluding rules: default") + logger.Println("excluding rules: default") } return rules.Generate(filters...) } @@ -192,7 +192,7 @@ func main() { // Load enabled rule definitions ruleDefinitions := loadRules(*flagRulesInclude, *flagRulesExclude) if len(ruleDefinitions) <= 0 { - log.Fatal("cannot continue: no rules are configured.") + logger.Fatal("cannot continue: no rules are configured.") } // Create the analyzer