-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlogger.go
51 lines (40 loc) · 852 Bytes
/
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
package raiden
import (
"os"
"github.com/hashicorp/go-hclog"
"github.com/sev-2/raiden/pkg/logger"
)
var logInstance hclog.Logger
func checkLogInstance() {
if logInstance == nil {
logInstance = logger.HcLog()
}
}
func SetLogLevel(level hclog.Level) {
checkLogInstance()
logInstance.SetLevel(level)
}
func Info(message string, v ...any) {
checkLogInstance()
logInstance.Info(message, v...)
}
func Debug(message string, v ...any) {
checkLogInstance()
logInstance.Debug(message, v...)
}
func Error(message string, v ...any) {
checkLogInstance()
logInstance.Error(message, v...)
}
func Warning(message string, v ...any) {
logInstance.Warn(message, v...)
}
func Panic(message string) {
checkLogInstance()
panic(message)
}
func Fatal(message string, v ...any) {
checkLogInstance()
logInstance.Error(message, v...)
os.Exit(1)
}