-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.go
63 lines (53 loc) · 1.13 KB
/
constants.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
63
package go_logger
var (
colors map[LogLevel]string
// Map from format's placeholders to printf verbs
phfs map[string]string
// Contains color strings for stdout
logNo uint64
// Default format of log message
defFmt = "#%[1]d %[2]s %[4]s:%[5]d ▶ %.3[6]s %[7]s"
// Default format of time
defTimeFmt = "2006-01-02 15:04:05"
)
// LogLevel type
type LogLevel int
// Log Level
const (
CriticalLevel LogLevel = iota + 1
ErrorLevel
WarningLevel
NoticeLevel
InfoLevel
DebugLevel
)
// Color numbers for stdout
const (
Black = (iota + 30)
Red
Green
Yellow
Blue
Magenta
Cyan
White
)
// Constant color maps
var (
defaultColors = map[LogLevel]string{
CriticalLevel: ColorString(Magenta),
ErrorLevel: ColorString(Red),
WarningLevel: ColorString(Yellow),
NoticeLevel: ColorString(Green),
DebugLevel: ColorString(Cyan),
InfoLevel: ColorString(White),
}
minimalColors = map[LogLevel]string{
CriticalLevel: ColorString(Red),
ErrorLevel: ColorString(Red),
WarningLevel: ColorString(Yellow),
NoticeLevel: ColorString(Green),
DebugLevel: ColorString(Green),
InfoLevel: ColorString(Green),
}
)