-
Notifications
You must be signed in to change notification settings - Fork 1
/
logger.go
58 lines (54 loc) · 1.47 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
package log
// LogLevel 日志级别
type LogLevel int
const (
// !nashtsai! following level also match syslog.Priority value
LOG_UNKNOWN LogLevel = iota - 2 // -2
LOG_OFF LogLevel = iota - 1 // -1
LOG_PRINT // 0
LOG_FATAL // 1
LOG_PANIC // 2
LOG_ERROR LogLevel = iota + 1 // 5
LOG_WARN // 6
LOG_INFO LogLevel = iota + 4 // 11
LOG_DEBUG // 12
)
var levelNames = map[LogLevel]string{
LOG_UNKNOWN: "UNKNOWN",
LOG_PRINT: "PRINT",
LOG_FATAL: "FATAL",
LOG_PANIC: "PANIC",
LOG_ERROR: "ERROR",
LOG_WARN: "WARN",
LOG_INFO: "INFO",
LOG_DEBUG: "DEBUG",
}
// Logger interface
type Logger interface {
Level() LogLevel
SetLevel(l LogLevel)
SetCopy(ch chan string)
Flush()
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
Fatalln(v ...interface{})
Panic(v ...interface{})
Panicf(format string, v ...interface{})
Panicln(v ...interface{})
Error(v ...interface{})
Errorf(format string, v ...interface{})
Errorln(v ...interface{})
Warn(v ...interface{})
Warnf(format string, v ...interface{})
Warnln(v ...interface{})
Info(v ...interface{})
Infof(format string, v ...interface{})
Infoln(v ...interface{})
Debug(v ...interface{})
Debugf(format string, v ...interface{})
Debugln(v ...interface{})
Output(calldepth int, s string) error
}