Merge pull request #9 from golangci/feature/log-handling-in-root

move log handling code into root command
This commit is contained in:
golangci 2018-05-26 09:48:45 +03:00 committed by GitHub
commit 4ce8d74b7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

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

View File

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