Documentation
¶
Index ¶
- type Level
- type Logger
- func (l *Logger) PrintError(err error, properties map[string]string)
- func (l *Logger) PrintFatal(err error, properties map[string]string)
- func (l *Logger) PrintInfo(message string, properties map[string]string)
- func (l *Logger) TryLog(message string, properties map[string]string)
- func (l *Logger) Write(message []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int8
Level represents the severity level of a log entry.
const ( LevelInfo Level = iota // Has the value of 0. LevelError // Has the value of 1. LevelFatal // Has the value of 2. LevelOff // Has the value of 3. )
Initialize constants which represent a specific severity level using the "iota" keyword as a shortcut to assign successive integer values to the constants.
type Logger ¶
type Logger struct { Verbose bool `json:"verbose"` // contains filtered or unexported fields }
Logger is the custom logger. It holds the output destination that the log entries will be written to, the minimum severity level that log entries will be written for, and a mutex for coordination the writes.
func NewLogger ¶
NewLogger returns a new Logger instance which writes log entries at or above a minimum severity level to a specific output destination.
func (*Logger) PrintError ¶
PrintError is a helper that writes Info level log entries.
func (*Logger) PrintFatal ¶
PrintFatal is a helper that writes Info level log entries. It also terminates the application.