Set logger level per package instead of doing this globally

This commit is contained in:
Oleksii Kliukin
2017-05-12 11:41:30 +02:00
committed by Murat Kabilov
parent 8db44d6f18
commit 8268b07ad2
4 changed files with 10 additions and 9 deletions
+5 -4
View File
@@ -39,15 +39,16 @@ type Controller struct {
}
func New(controllerConfig *Config, operatorConfig *config.Config) *Controller {
logger := logrus.New()
if operatorConfig.DebugLogging {
logrus.SetLevel(logrus.DebugLevel)
logger.Level = logrus.DebugLevel
}
logger := logrus.WithField("pkg", "controller")
logger.Debugf("Debug output enabled")
return &Controller{
Config: *controllerConfig,
opConfig: operatorConfig,
logger: logger,
logger: logger.WithField("pkg", "controller"),
clusters: make(map[spec.ClusterName]*cluster.Cluster),
stopChMap: make(map[spec.ClusterName]chan struct{}),
podCh: make(chan spec.PodEvent),