Skip to content

Commit 4ce8d74

Browse files
author
golangci
authored
Merge pull request #9 from golangci/feature/log-handling-in-root
move log handling code into root command
2 parents 2e1149a + d864898 commit 4ce8d74

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

cmd/golangci-lint/main.go

-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
package main
22

33
import (
4-
"log"
5-
64
"github.com/golangci/golangci-lint/pkg/commands"
7-
"github.com/sirupsen/logrus"
85
)
96

107
func main() {
11-
log.SetFlags(0) // don't print time
12-
logrus.SetLevel(logrus.WarnLevel)
13-
148
e := commands.NewExecutor()
159
if err := e.Execute(); err != nil {
1610
panic(err)

pkg/commands/root.go

+3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ func (e *Executor) initRoot() {
2323
PersistentPreRun: func(cmd *cobra.Command, args []string) {
2424
runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
2525

26+
log.SetFlags(0) // don't print time
2627
if e.cfg.Run.IsVerbose {
2728
logrus.SetLevel(logrus.InfoLevel)
29+
} else {
30+
logrus.SetLevel(logrus.WarnLevel)
2831
}
2932

3033
if e.cfg.Run.CPUProfilePath != "" {

0 commit comments

Comments
 (0)