-
Notifications
You must be signed in to change notification settings - Fork 342
/
Logger.go
64 lines (49 loc) · 1.26 KB
/
Logger.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package internal
import (
"github.com/hashicorp/go-hclog"
"github.com/sirupsen/logrus"
"github.com/treeverse/lakefs/pkg/logging"
)
type HClogger struct {
hclog.Logger
logger logging.Logger
}
func NewHClogger(hcl hclog.Logger, logger logging.Logger) HClogger {
return HClogger{Logger: hcl, logger: logger}
}
func (l HClogger) Log(level hclog.Level, msg string, args ...interface{}) {
l.logger.Log(logrus.Level(level), msg, args)
}
func (l HClogger) Trace(msg string, args ...interface{}) {
l.logger.Trace(msg, args)
}
func (l HClogger) Debug(msg string, args ...interface{}) {
l.logger.Debug(msg, args)
}
func (l HClogger) Info(msg string, args ...interface{}) {
l.logger.Info(msg, args)
}
func (l HClogger) Warn(msg string, args ...interface{}) {
l.logger.Warn(msg, args)
}
func (l HClogger) Error(msg string, args ...interface{}) {
l.logger.Error(msg, args)
}
func (l HClogger) IsTrace() bool {
return l.logger.IsTracing()
}
func (l HClogger) IsDebug() bool {
return l.logger.IsDebugging()
}
func (l HClogger) IsInfo() bool {
return l.logger.IsInfo()
}
func (l HClogger) IsWarn() bool {
return l.logger.IsWarn()
}
func (l HClogger) IsError() bool {
return l.logger.IsError()
}
func (l HClogger) SetLevel(level hclog.Level) {
logging.SetLevel(string(level))
}