-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.go
58 lines (48 loc) · 923 Bytes
/
base.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
/**
* @file logger.go
* @author ligang
* @date 2016-02-04
*/
package golog
import "io"
const (
LEVEL_DEBUG = 1
LEVEL_INFO = 2
LEVEL_NOTICE = 3
LEVEL_WARNING = 4
LEVEL_ERROR = 5
LEVEL_CRITICAL = 6
LEVEL_ALERT = 7
LEVEL_EMERGENCY = 8
)
var logLevels map[int]string = map[int]string{
LEVEL_DEBUG: "debug",
LEVEL_INFO: "info",
LEVEL_NOTICE: "notice",
LEVEL_WARNING: "warning",
LEVEL_ERROR: "error",
LEVEL_CRITICAL: "critical",
LEVEL_ALERT: "alert",
LEVEL_EMERGENCY: "emergency",
}
type ILogger interface {
Debug(msg []byte)
Info(msg []byte)
Notice(msg []byte)
Warning(msg []byte)
Error(msg []byte)
Critical(msg []byte)
Alert(msg []byte)
Emergency(msg []byte)
Log(level int, msg []byte) error
Flush() error
Free()
}
type IFormater interface {
Format(level int, msg []byte) []byte
}
type IWriter interface {
io.Writer
Flush() error
Free()
}