Documentation ¶
Index ¶
- type ILogger
- type JSONLogger
- type LogFormat
- type LogType
- type Logger
- type SimpleLogger
- func (logger *SimpleLogger) Debugf(message string, args ...interface{})
- func (logger *SimpleLogger) DisableColors()
- func (logger *SimpleLogger) EnableColors()
- func (logger *SimpleLogger) Errorf(message string, args ...interface{})
- func (logger *SimpleLogger) Infof(message string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ILogger ¶
type ILogger interface { Debugf(message string, args ...interface{}) DisableColors() EnableColors() Errorf(message string, args ...interface{}) Infof(message string, args ...interface{}) }
ILogger is an interface that describes how a logger should behave
func LogFactory ¶
LogFactory returns a logger in the required format
func NewJSONLogger ¶
NewJSONLogger returns an instance of an ILogger interface set to the JSON logger format
func NewSimpleLogger ¶
NewSimpleLogger returns an instance of an ILogger interface set to the simple logger format
type JSONLogger ¶
type JSONLogger struct {
Logger
}
JSONLogger is a console logger that has a format of `{"applicationName": "{ApplicationName}", "type": "{Type}"", "message": "{Message}"}`
func (*JSONLogger) Debugf ¶
func (logger *JSONLogger) Debugf(message string, args ...interface{})
Debugf writes a formatted debug entry to the log
func (*JSONLogger) DisableColors ¶
func (logger *JSONLogger) DisableColors()
DisableColors turns of console coloring
func (*JSONLogger) EnableColors ¶
func (logger *JSONLogger) EnableColors()
EnableColors turns on console coloring
func (*JSONLogger) Errorf ¶
func (logger *JSONLogger) Errorf(message string, args ...interface{})
Errorf writes a formatted error entry to the log
func (*JSONLogger) Infof ¶
func (logger *JSONLogger) Infof(message string, args ...interface{})
Infof writes a formatted info entry to the log
type LogFormat ¶
type LogFormat int
LogFormat describes how to format log messages
Constants for the available log formats
func StringToLogFormat ¶
StringToLogFormat converts a specified string to a LogFormat. If the string does not match a specific log type the SIMPLE is returned.
type LogType ¶
type LogType int
LogType represents a type and level of logging
Constants for the type and levels of logging
func StringToLogType ¶
StringToLogType converts a specified string to a LogType. If the string does not match a specific log type the NONE is returned.
type Logger ¶
type Logger struct { ApplicationName string LogLevel LogType LogFormat LogFormat // contains filtered or unexported fields }
Logger represents the basic instance of a logging object. Other, more specific loggers will use this
type SimpleLogger ¶
type SimpleLogger struct {
Logger
}
SimpleLogger is a basic console logger that has a format of `{ApplicationName}: {Type} - {Message}`
func (*SimpleLogger) Debugf ¶
func (logger *SimpleLogger) Debugf(message string, args ...interface{})
Debugf writes a formatted debug entry to the log
func (*SimpleLogger) DisableColors ¶
func (logger *SimpleLogger) DisableColors()
DisableColors turns of console coloring
func (*SimpleLogger) EnableColors ¶
func (logger *SimpleLogger) EnableColors()
EnableColors turns on console coloring
func (*SimpleLogger) Errorf ¶
func (logger *SimpleLogger) Errorf(message string, args ...interface{})
Errorf writes a formatted error entry to the log
func (*SimpleLogger) Infof ¶
func (logger *SimpleLogger) Infof(message string, args ...interface{})
Infof writes a formatted info entry to the log