Merge pull request #9 from golangci/feature/log-handling-in-root
move log handling code into root command
This commit is contained in:
commit
4ce8d74b7a
@ -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)
|
||||
|
@ -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 != "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user