-
Notifications
You must be signed in to change notification settings - Fork 0
/
priority.go
110 lines (102 loc) · 2.53 KB
/
priority.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package syslog
// Facility represents a message source as defined by RFC 3164.
type Facility byte
// The following is a list of Facilities as defined by RFC 3164.
const (
Kern Facility = iota // kernel messages
User // user-level messages
Mail // mail system
Daemon // system daemons
Auth // security/authorization messages
Syslog // messages internal to syslogd
Lpr // line printer subsystem
News // newtork news subsystem
Uucp // UUCP subsystem
Cron // cron messages
Authpriv // security/authorization messages
System0 // historically FTP daemon
System1 // historically NTP subsystem
System2 // historically log audit
System3 // historically log alert
System4 // historically clock daemon, some operating systems use this for cron
Local0 // local use 0
Local1 // local use 1
Local2 // local use 2
Local3 // local use 3
Local4 // local use 4
Local5 // local use 5
Local6 // local use 6
Local7 // local use 7
)
var facToStr = [...]string{
"kern",
"user",
"mail",
"daemon",
"auth",
"syslog",
"lpr",
"news",
"uucp",
"cron",
"authpriv",
"system0",
"system1",
"system2",
"system3",
"system4",
"local0",
"local1",
"local2",
"local3",
"local4",
"local5",
"local6",
"local7",
}
// String returns a string representation of the Facility. This satisfies the
// fmt.Stringer interface.
func (f Facility) String() string {
if f > Local7 {
return "unknown"
}
return facToStr[f]
}
// Severity represents a level of messsage importance.
type Severity byte
const (
// Emerg - system is unusable
Emerg Severity = iota
// Alert - immediate action required
Alert
// Crit - critical conditions
Crit
// Err - error conditions
Err
// Warning - warning conditions
Warning
// Notice - normal but significant condition
Notice
// Info - information message
Info
// Debug - debug-level message
Debug
)
var sevToStr = [...]string{
"emerg",
"alert",
"crit",
"err",
"waining",
"notice",
"info",
"debug",
}
// String returns a string representation of the Severity. This satisfies the
// fmt.Stringer interface.
func (s Severity) String() string {
if s > Debug {
return "unknown"
}
return sevToStr[s]
}