-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
62 lines (56 loc) · 1.22 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
package l3
const (
//Off - No logging
Off Level = iota
//Err - logging only for error level.
Err
//Warn - logging turned on for warning & error levels
Warn
//Info - logging turned on for Info, Warning and Error levels.
Info
//Debug - Logging turned on for Debug, Info, Warning and Error levels.
Debug
//Trace - Logging turned on for Trace,Info, Warning and error Levels.
Trace
)
//Level specifies the log level
type Level int
//Levels of the logging by severity
var Levels = [...]string{
"OFF",
"ERROR",
"WARN",
"INFO",
"DEBUG",
"TRACE",
}
// LevelsBytes of the logging by Level
var LevelsBytes = [...][]byte{
[]byte("OFF"),
[]byte("ERROR"),
[]byte("WARN"),
[]byte("INFO"),
[]byte("DEBUG"),
[]byte("TRACE"),
}
//LevelsMap of the logging by Level string Level type
var LevelsMap = map[string]Level{
"OFF": Off,
"ERROR": Err,
"WARN": Warn,
"INFO": Info,
"DEBUG": Debug,
"TRACE": Trace,
}
type Logger interface {
Error(a ...interface{})
ErrorF(f string, a ...interface{})
Warn(a ...interface{})
WarnF(f string, a ...interface{})
Info(a ...interface{})
InfoF(f string, a ...interface{})
Debug(a ...interface{})
DebugF(f string, a ...interface{})
Trace(a ...interface{})
TraceF(f string, a ...interface{})
}