This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.go
102 lines (95 loc) · 3.78 KB
/
log.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
package l5424 // import "github.com/justanotherorganization/l5424"
type (
// Logger is based on the standard logger proposals discussed in detail, linked below
// https://docs.google.com/document/d/1oTjtY49y8iSxmM9YBaz2NrZIlaXtQsq3nQMd-E0HtwM/edit#
Logger interface {
// Log is a flexible log function described in the standard logger proposals.
Log(...interface{}) error
}
// NoOpLogger implements Logger, it can be passed as a simple way to disable logging.
NoOpLogger struct{}
)
type (
// FacilityLvl values are not normative however are defined in the RFC. They are provided for convenience.
FacilityLvl uint
// SeverityLvl values are not normative however are defined in the RFC. They are provided for convenience.
SeverityLvl uint
)
const (
// FacilityKernel should be used for messages originating from the kernel.
FacilityKernel FacilityLvl = iota
// FacilityUser should be used for messages originating at the user level.
FacilityUser
// FacilityMail should be used for messages originating at a mail system.
FacilityMail
// FacilitySystemD should be used for messages originating from within a system daemon.
FacilitySystemD
// FacilitySecurity should be used for messages related to security or authorization.
FacilitySecurity
// FacilitySyslogD should be used for messages originating from syslogd.
FacilitySyslogD
// FacilityPrinter should be used for messages originating from a printer system.
FacilityPrinter
// FacilityNews should be used for messages originating from a network news system.
FacilityNews
// FacilityUUCP should be used for messages originating from a UUCP system.
FacilityUUCP
// FacilityClock should be used for messages originating from a clock daemon.
FacilityClock
// FacilityAuthorization should be used for messages related to security or authotization.
// The RFC makes little distinction between FacilityAuthorization and FacilitySecurity, the
// difference here is in name only.
FacilityAuthorization
// FacilityFTP should be used for messages originating from a FTP daemon.
FacilityFTP
// FacilityNTP should be used for messages originating from a NTP daemon.
FacilityNTP
// FacilityAudit should be used for informational messages.
FacilityAudit
// FacilityAlert should be used for alert messages.
FacilityAlert
// FacilityClockD should be used for messages originating from a clock daemon.
// The RFC makes little distinction between FacilityClockD and FacilityClockD, the
// difference here is in name only.
FacilityClockD
// FacilityLocal0 should be used for messages originating from a local system.
FacilityLocal0
// FacilityLocal1 should be used for messages originating from a local system.
FacilityLocal1
// FacilityLocal2 should be used for messages originating from a local system.
FacilityLocal2
// FacilityLocal3 should be used for messages originating from a local system.
FacilityLocal3
// FacilityLocal4 should be used for messages originating from a local system.
FacilityLocal4
// FacilityLocal5 should be used for messages originating from a local system.
FacilityLocal5
// FacilityLocal6 should be used for messages originating from a local system.
FacilityLocal6
// FacilityLocal7 should be used for messages originating from a local system.
FacilityLocal7
)
const (
// EmergencyLvl system is unusable
EmergencyLvl SeverityLvl = iota
// AlertLvl action must be taken immediately
AlertLvl
// CritLvl critical conditions
CritLvl
// ErrorLvl error conditions
ErrorLvl
// WarnLvl warning conditions
WarnLvl
// NoticeLvl normal but signifcant condition
NoticeLvl
// InfoLvl informational messages
InfoLvl
// DebugLvl debug-level messages
DebugLvl
)
// Static type checking.
var _ Logger = &NoOpLogger{}
// Log returns nil without performing any operations.
func (l *NoOpLogger) Log(v ...interface{}) error {
return nil
}