Documentation
¶
Overview ¶
Package l5424 is a collection of RFC5424 compliant logging interfaces and loggers.
The point of this repo is to show several possible ways of implementing RFC5424 compliant loggers.
The Go Language is extremely fragmented in how it addresses logging. The goal of this project is to try to start discussion regarding some form of standardized logging in Go.
During the course of this project it's come to my attention that a #logging channel exists in the current Gopher's slack for the purpose of standardizing logging in Go (which was a partial goal for this project, yay!).
Having read through the different proposals outlined in [Proposal: Add Logging interface to standard library](https://docs.google.com/document/d/1oTjtY49y8iSxmM9YBaz2NrZIlaXtQsq3nQMd-E0HtwM/edit#) I've come to the conclusion that my original implementations of RFC5424 loggers being based purely on the RFC were naive (at best) and have abandoned my original implementations. They can be found in the [legacy](https://github.com/justanotherorganization/l5424/tree/legacy) branch of this repo but will not be directly maintained (in the very unlikely event someone chooses to use them I will welcome any bug fixes (if there are bugs) but that is all that will be accepted for the legacy loggers).
Only one interface is provided and that is the one described in the above mentioned proposals.
If you're reading this you are encouraged to play with the interface and loggers as well as read the above proposals and the existing RFC5424 standard.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FacilityLvl ¶
type FacilityLvl uint
FacilityLvl values are not normative however are defined in the RFC. They are provided for convenience.
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 )
func FacilityLvlString ¶
func FacilityLvlString(s string) (FacilityLvl, error)
FacilityLvlString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func FacilityLvlValues ¶
func FacilityLvlValues() []FacilityLvl
FacilityLvlValues returns all values of the enum
func (FacilityLvl) IsAFacilityLvl ¶
func (i FacilityLvl) IsAFacilityLvl() bool
IsAFacilityLvl returns "true" if the value is listed in the enum definition. "false" otherwise
func (FacilityLvl) String ¶
func (i FacilityLvl) String() string
type Logger ¶
type Logger interface {
// Log is a flexible log function described in the standard logger proposals.
Log(...interface{}) error
}
Logger is based on the standard logger proposals discussed in detail, linked below https://docs.google.com/document/d/1oTjtY49y8iSxmM9YBaz2NrZIlaXtQsq3nQMd-E0HtwM/edit#
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger implements Logger, it can be passed as a simple way to disable logging.
func (*NoOpLogger) Log ¶
func (l *NoOpLogger) Log(v ...interface{}) error
Log returns nil without performing any operations.
type SeverityLvl ¶
type SeverityLvl uint
SeverityLvl values are not normative however are defined in the RFC. They are provided for convenience.
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 )
func SeverityLvlString ¶
func SeverityLvlString(s string) (SeverityLvl, error)
SeverityLvlString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func SeverityLvlValues ¶
func SeverityLvlValues() []SeverityLvl
SeverityLvlValues returns all values of the enum
func (SeverityLvl) IsASeverityLvl ¶
func (i SeverityLvl) IsASeverityLvl() bool
IsASeverityLvl returns "true" if the value is listed in the enum definition. "false" otherwise
func (SeverityLvl) String ¶
func (i SeverityLvl) String() string