summaryrefslogtreecommitdiffstats
path: root/proxy/log.go
blob: 2ab47045b0b51c045bb7c8289170587eceb6c48b (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
32
33
34
35
36
package proxy

import (
	"io"
	"os"

	"github.com/sirupsen/logrus"
)

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

	log = logrus.New()
)

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

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

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

// SetOutput sets log output for logger.
func SetLogOutput(out io.Writer) {
	log.Out = out
}