aboutsummaryrefslogtreecommitdiffstats
path: root/proxy/log.go
blob: d53e532ae5539c2d82ed248ed88d676061daf5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package proxy

import (
	"os"

	"github.com/sirupsen/logrus"
)

var (
	debug = os.Getenv("DEBUG_GOVPP_PROXY") != ""

	log = logrus.New()
)

func init() {
	log.Out = os.Stdout
	if debug {
		log.Level = logrus.DebugLevel
		log.Debugf("govpp/proxy: debug mode enabled")
	}
}

// SetLogger sets global logger to l.
func SetLogger(l *logrus.Logger) {
	log = l
}

// SetLogLevel sets global logger level to lvl.
func SetLogLevel(lvl logrus.Level) {
	log.Level = lvl
}