blob: aaef4cc517f2ecbdccc46683b007089605dce70a (
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
|
package core
import (
"os"
logger "github.com/sirupsen/logrus"
)
var (
debug = os.Getenv("DEBUG_GOVPP") != ""
debugMsgIDs = os.Getenv("DEBUG_GOVPP_MSGIDS") != ""
log = logger.New() // global logger
)
// init initializes global logger, which logs debug level messages to stdout.
func init() {
log.Out = os.Stdout
if debug {
log.Level = logger.DebugLevel
}
}
// SetLogger sets global logger to l.
func SetLogger(l *logger.Logger) {
log = l
}
// SetLogLevel sets global logger level to lvl.
func SetLogLevel(lvl logger.Level) {
log.Level = lvl
}
|