Documentation ¶
Index ¶
- func BlacklistFunctions(names ...string)
- func BlacklistPackages(names ...string)
- func ClearBlacklist()
- func ClearOutputs()
- func ClearWhitelist()
- func Debug(msg ...string)
- func Debugf(format string, arguments ...interface{})
- func Error(msg ...string)
- func Errorf(format string, arguments ...interface{})
- func Info(msg ...string)
- func Infof(format string, arguments ...interface{})
- func SetDebugMode(state bool)
- func SetFormattedOutputs(outputs map[io.Writer]Formatter)
- func SetOutputs(output ...io.Writer)
- func WhitelistFunctions(names ...string)
- func WhitelistPackages(names ...string)
- func XDebug(msg ...string)
- type CSVFormatter
- type DefaultFormatter
- type Formatter
- type JSONFormatter
- type Level
- type Logger
- func (logger *Logger) BlacklistFunctions(names ...string)
- func (logger *Logger) BlacklistPackages(names ...string)
- func (logger *Logger) ClearBlacklist()
- func (logger *Logger) ClearOutputs()
- func (logger *Logger) ClearWhitelist()
- func (logger *Logger) Debug(msg ...string)
- func (logger *Logger) Debugf(format string, arguments ...interface{})
- func (logger *Logger) Error(msg ...string)
- func (logger *Logger) Errorf(format string, arguments ...interface{})
- func (logger *Logger) Info(msg ...string)
- func (logger *Logger) Infof(format string, arguments ...interface{})
- func (logger *Logger) SetDebugMode(state bool)
- func (logger *Logger) SetFormattedOutputs(outputs map[io.Writer]Formatter)
- func (logger *Logger) SetOutputs(outputs ...io.Writer)
- func (logger *Logger) WhitelistFunctions(names ...string)
- func (logger *Logger) WhitelistPackages(names ...string)
- func (logger *Logger) XDebug(msg ...string)
- func (logger *Logger) XDebugf(format string, arguments ...interface{})
- type RawFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlacklistFunctions ¶
func BlacklistFunctions(names ...string)
BlacklistFunctions adds the provided function names to the global loggers debug output blacklist
func BlacklistPackages ¶
func BlacklistPackages(names ...string)
BlacklistPackages adds the provided package names to the global loggers debug output blacklist
func ClearBlacklist ¶
func ClearBlacklist()
ClearBlacklist removes all entries from the global loggers blacklist
func ClearWhitelist ¶
func ClearWhitelist()
ClearWhitelist removes all entries from the global loggers whitelist
func Debugf ¶
func Debugf(format string, arguments ...interface{})
Debugf writes a formatted error message to the global log
func Errorf ¶
func Errorf(format string, arguments ...interface{})
Errorf writes a formatted error message to the global log
func Infof ¶
func Infof(format string, arguments ...interface{})
Infof writes a formatted error message to the global log
func SetDebugMode ¶
func SetDebugMode(state bool)
SetDebugMode toggles if debug messages are written to the global loggers outputs
func SetFormattedOutputs ¶
SetFormattedOutputs adds the provided io.Writer to the output of the global logger using the provided formatter
func SetOutputs ¶
SetOutputs adds the provided io.Writers to the output of the global logger using the global formatter
func WhitelistFunctions ¶
func WhitelistFunctions(names ...string)
WhitelistFunctions adds the provided function names to the global loggers debug output whitelist
func WhitelistPackages ¶
func WhitelistPackages(names ...string)
WhitelistPackages adds the provided package name to the global loggers debug output whitelist
Types ¶
type CSVFormatter ¶ added in v1.0.1
type CSVFormatter struct { ColorsDisabled bool TimestampDisabled bool TimestampLayout string Clock clock.Clock CallerDisabled bool }
CSVFormatter formats the log to csv lines with timestamp, package, function, log level and message
func NewCSVFormatter ¶ added in v1.0.1
func NewCSVFormatter() *CSVFormatter
type DefaultFormatter ¶
type DefaultFormatter struct { ColorsDisabled bool Colors map[Level]color.Style TimestampDisabled bool TimestampLayout string Clock clock.Clock CallerDisabled bool }
DefaultFormatter formats log to human readable text with timestamp, caller and log level
func NewDefaultFormatter ¶
func NewDefaultFormatter() (f *DefaultFormatter)
NewDefaultFormatter initializes a new DefaultFormatter
type JSONFormatter ¶
type JSONFormatter struct { ColorsDisabled bool TimestampDisabled bool TimestampLayout string Clock clock.Clock CallerDisabled bool PrettyPrint bool }
JSONFormatter formats log to json objects with timestamp, function, package and log level
func NewJSONFormatter ¶
func NewJSONFormatter() *JSONFormatter
NewJSONFormatter initializes a new JSONFormatter
type Level ¶
type Level int
The Level describes the severity of the log message
const ( // DebugLevel is used for messages for the developer debugging the application DebugLevel Level = iota // InfoLevel is used for messages for the user running the application InfoLevel // ErrorLevel is used in case the application encountered an unhandleable error and will terminate after messaging ErrorLevel )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger writes formatted messages to the set of outputs.
func NewDefaultLogger ¶
func NewDefaultLogger() (logger *Logger)
NewDefaultLogger initializes a new logger configured to write its output to the stdout console using the default formatter
func NewLogger ¶
func NewLogger() (logger *Logger)
NewLogger initializes a new empty logger with no outputs configured
func (*Logger) BlacklistFunctions ¶
BlacklistFunctions adds the provided function names to the loggers debug output blacklist
func (*Logger) BlacklistPackages ¶
BlacklistPackages adds the provided package names to the loggers debug output blacklist
func (*Logger) ClearBlacklist ¶
func (logger *Logger) ClearBlacklist()
ClearBlacklist removes all entries from the loggers blacklist
func (*Logger) ClearOutputs ¶
func (logger *Logger) ClearOutputs()
ClearOutputs removes all set outputs from the logger
func (*Logger) ClearWhitelist ¶
func (logger *Logger) ClearWhitelist()
ClearWhitelist removes all entries from the loggers whitelist
func (*Logger) SetDebugMode ¶
SetDebugMode toggles if debug messages are written to the loggers outputs
func (*Logger) SetFormattedOutputs ¶
SetFormattedOutputs adds the provided io.Writers to the loggers outputs with the provided custom formatters
func (*Logger) SetOutputs ¶
SetOutputs adds the provided io.Writers to the loggers outputs using the default formatter
func (*Logger) WhitelistFunctions ¶
WhitelistFunctions adds the provided function names to the loggers debug output whitelist
func (*Logger) WhitelistPackages ¶
WhitelistPackages adds the provided package name to the loggers debug output whitelist
type RawFormatter ¶
type RawFormatter struct {
ColorsDisabled bool
}
RawFormatter formats log to just the message
func NewRawFormatter ¶
func NewRawFormatter() (f *RawFormatter)
NewRawFormatter initializes a new RawFormatter