Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnkownLogLevel = errors.New("Unkown loglevel")
ErrUnkownLogLevel will be returned, if the loglevel can not be parsed and is unkown
Functions ¶
This section is empty.
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel describes which level of logs will be written on the writers
const ( // LogLevelDebug instruct the logger to write debug, info, warn, error and // fatal logs into the defined writers LogLevelDebug LogLevel = iota + 1 // LogLevelInfo instruct the logger to write info, warn, error and fatal logs // into the defined writers LogLevelInfo // LogLevelWarn instruct the logger to write warn, error and fatal logs into // the defined writers LogLevelWarn // LogLevelError instruct the logger to write error and fatal logs into the // defined writers LogLevelError // LogLevelFatal instruct the logger to write only fatal logs into the // defined writer LogLevelFatal )
func ParseLogLevel ¶
ParseLogLevel parse the matching LogLevel from a string variable and returns it as LogLevel constante. - 1, debug, DEBUG => LogLevelDebug - 2, info, INFO => LogLevelInfo - 3, warn, WARN => LogLevelWARN - 4, error, ERROR => LogLevelError - 5, fatal, FATAL => LogLevelFatal
type Logger ¶
type Logger interface { Debug(string, ...interface{}) Info(string, ...interface{}) Warn(string, ...interface{}) Error(string, ...interface{}) Fatal(string, ...interface{}) }
Logger interface to define a logger
func NewCustomLogger ¶
NewCustomLogger returns a new logger which writes his logs on writer out. Error and fatal logs will be written on writer err.
func NewLogger ¶
NewLogger returns a new logger which writes his logs on stdout. Error and fatal logs will be written on stderr.
func NewSilentLogger ¶
func NewSilentLogger() Logger
NewSilentLogger returns a new logger which discard all his logs