forked from HazelnutParadise/insyra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
40 lines (35 loc) · 782 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
package insyra
import "log"
func LogFatal(msg string, args ...interface{}) {
if msg[len(msg)-1] != '\n' {
msg += "\n"
}
log.Fatalf("<{[insyra - FATAL!]}> "+msg, args...)
}
func LogWarning(msg string, args ...interface{}) {
if Config.GetLogLevel() > LogLevelWarning {
return
}
if msg[len(msg)-1] != '\n' {
msg += "\n"
}
log.Printf("[insyra - Warning] "+msg, args...)
}
func LogDebug(msg string, args ...interface{}) {
if Config.GetLogLevel() > LogLevelDebug {
return
}
if msg[len(msg)-1] != '\n' {
msg += "\n"
}
log.Printf("<insyra - Debug> "+msg, args...)
}
func LogInfo(msg string, args ...interface{}) {
if Config.GetLogLevel() > LogLevelInfo {
return
}
if msg[len(msg)-1] != '\n' {
msg += "\n"
}
log.Printf("[insyra - Info] "+msg, args...)
}