move log handling code into root command

This commit is contained in:
golangci 2018-05-25 22:30:44 +03:00
parent 826ca739a1
commit d86489893d
2 changed files with 3 additions and 6 deletions

View File

@ -1,16 +1,10 @@
package main package main
import ( import (
"log"
"github.com/golangci/golangci-lint/pkg/commands" "github.com/golangci/golangci-lint/pkg/commands"
"github.com/sirupsen/logrus"
) )
func main() { func main() {
log.SetFlags(0) // don't print time
logrus.SetLevel(logrus.WarnLevel)
e := commands.NewExecutor() e := commands.NewExecutor()
if err := e.Execute(); err != nil { if err := e.Execute(); err != nil {
panic(err) panic(err)

View File

@ -23,8 +23,11 @@ func (e *Executor) initRoot() {
PersistentPreRun: func(cmd *cobra.Command, args []string) { PersistentPreRun: func(cmd *cobra.Command, args []string) {
runtime.GOMAXPROCS(e.cfg.Run.Concurrency) runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
log.SetFlags(0) // don't print time
if e.cfg.Run.IsVerbose { if e.cfg.Run.IsVerbose {
logrus.SetLevel(logrus.InfoLevel) logrus.SetLevel(logrus.InfoLevel)
} else {
logrus.SetLevel(logrus.WarnLevel)
} }
if e.cfg.Run.CPUProfilePath != "" { if e.cfg.Run.CPUProfilePath != "" {