Skip to content

Commit 5361949

Browse files
committed
Sending log messages to multiple streams
Use the configured logger for all log messages.
1 parent 51b4a4d commit 5361949

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmd/gas/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ func loadConfig(configFile string) (gas.Config, error) {
125125
func loadRules(include, exclude string) rules.RuleList {
126126
var filters []rules.RuleFilter
127127
if include != "" {
128-
log.Printf("including rules: %s", include)
128+
logger.Printf("including rules: %s", include)
129129
including := strings.Split(include, ",")
130130
filters = append(filters, rules.NewRuleFilter(false, including...))
131131
} else {
132-
log.Println("including rules: default")
132+
logger.Println("including rules: default")
133133
}
134134

135135
if exclude != "" {
136-
log.Printf("excluding rules: %s", exclude)
136+
logger.Printf("excluding rules: %s", exclude)
137137
excluding := strings.Split(exclude, ",")
138138
filters = append(filters, rules.NewRuleFilter(true, excluding...))
139139
} else {
140-
log.Println("excluding rules: default")
140+
logger.Println("excluding rules: default")
141141
}
142142
return rules.Generate(filters...)
143143
}
@@ -192,7 +192,7 @@ func main() {
192192
// Load enabled rule definitions
193193
ruleDefinitions := loadRules(*flagRulesInclude, *flagRulesExclude)
194194
if len(ruleDefinitions) <= 0 {
195-
log.Fatal("cannot continue: no rules are configured.")
195+
logger.Fatal("cannot continue: no rules are configured.")
196196
}
197197

198198
// Create the analyzer

0 commit comments

Comments
 (0)