Documentation
¶
Index ¶
- type ErrorHandler
- type FileOptions
- type LogLevel
- type Logger
- func (logger *Logger) Debug(level uint, obj interface{})
- func (logger *Logger) Destroy()
- func (logger *Logger) Error(obj interface{})
- func (logger *Logger) Info(obj interface{})
- func (logger *Logger) SetDebugLevel(newLevel uint)
- func (logger *Logger) SetLevel(newLevel LogLevel)
- func (logger *Logger) Warning(obj interface{})
- type Options
- type SyslogOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandler ¶ added in v1.2.0
type ErrorHandler func(message string)
ErrorHandler is a callback to call if an internal error must be notified.
type FileOptions ¶ added in v1.2.0
FileOptions specifies the file logger settings.
type Logger ¶ added in v1.2.0
type Logger struct {
// contains filtered or unexported fields
}
Logger is the object that controls logging.
func Default ¶ added in v1.2.0
func Default() *Logger
Default returns a logger that only outputs error and warnings to the console.
func (*Logger) Debug ¶ added in v1.2.0
Debug emits a debug message into the configured targets. If a string is passed, output format will be in DATE [LEVEL] MESSAGE. If a struct is passed, output will be in json with level and timestamp fields automatically added.
func (*Logger) Destroy ¶ added in v1.2.0
func (logger *Logger) Destroy()
Destroy shuts down the logger.
func (*Logger) Error ¶ added in v1.2.0
func (logger *Logger) Error(obj interface{})
Error emits an error message into the configured targets. If a string is passed, output format will be in DATE [LEVEL] MESSAGE. If a struct is passed, output will be in json with level and timestamp fields automatically added.
func (*Logger) Info ¶ added in v1.2.0
func (logger *Logger) Info(obj interface{})
Info emits an information message into the configured targets. If a string is passed, output format will be in DATE [LEVEL] MESSAGE. If a struct is passed, output will be in json with level and timestamp fields automatically added.
func (*Logger) SetDebugLevel ¶ added in v1.2.0
SetDebugLevel sets the minimum level for debug messages.
func (*Logger) Warning ¶ added in v1.2.0
func (logger *Logger) Warning(obj interface{})
Warning emits a warning message into the configured targets. If a string is passed, output format will be in DATE [LEVEL] MESSAGE. If a struct is passed, output will be in json with level and timestamp fields automatically added.
type Options ¶
type Options struct {
// Disable console output.
DisableConsole bool `json:"disableConsole,omitempty"`
// Optionally enable file logging and establish its settings.
FileLog *FileOptions `json:"fileLog,omitempty"`
// Optionally enable syslog logging and establish its settings.
SysLog *SyslogOptions `json:"sysLog,omitempty"`
// Set the initial logging level to use.
Level LogLevel `json:"level,omitempty"`
// Set the initial logging level for debug output to use.
DebugLevel uint `json:"debugLevel,omitempty"`
// Use the local computer time instead of UTC.
UseLocalTime bool `json:"useLocalTime,omitempty"`
// A callback to call if an internal error is encountered.
ErrorHandler ErrorHandler
}
Options specifies the logger settings to use when initialized.
type SyslogOptions ¶ added in v1.2.0
SyslogOptions specifies the syslog logger settings.