Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultFormat = "%{color}%{time:15:04:05.000}: %{module} %{level} %{color:reset} %{message}" CliFormat = "%{color}%{message}%{color:reset}" DefaultModuleLevel = ModuleLevel{"", DEBUG} )
Log formats.
Functions ¶
func SetUpBasicLogging ¶
func SetUpBasicLogging(w io.Writer, format string, levels ...ModuleLevel)
SetUpBasicLogging configures logging to output logs to w, if levels are nil DefaultModuleLevel is used.
func SetUpLogging ¶
SetUpLogging configures logging based on configuration
Types ¶
type BufWritter ¶
type BufWritter struct {
}
BufWritter is a thread safe in memory writer, different go routines trees write to different buffers.
type Logger ¶
type Logger interface {
// Fatal is equivalent to l.Critical(fmt.Sprint()) followed by a call to os.Exit(1).
Fatal(args ...interface{})
// Fatalf is equivalent to l.Critical followed by a call to os.Exit(1).
Fatalf(format string, args ...interface{})
// Panic is equivalent to l.Critical(fmt.Sprint()) followed by a call to panic().
Panic(args ...interface{})
// Panicf is equivalent to l.Critical followed by a call to panic().
Panicf(format string, args ...interface{})
// Critical logs a message using CRITICAL as log level.
Critical(format string, args ...interface{})
// Error logs a message using ERROR as log level.
Error(format string, args ...interface{})
// Warning logs a message using WARNING as log level.
Warning(format string, args ...interface{})
// Notice logs a message using NOTICE as log level.
Notice(format string, args ...interface{})
// Info logs a message using INFO as log level.
Info(format string, args ...interface{})
// Debug logs a message using DEBUG as log level.
Debug(format string, args ...interface{})
}
Logger provides logging capabilities.
func NewLogger ¶
func NewLogger() Logger
NewLogger creates new logger for automatically retrieved module name.
func NewLoggerForModule ¶
NewLoggerForModule creates new logger for a given module name.
type ModuleLevel ¶
ModuleLevel holds module name with desired log level.
Click to show internal directories.
Click to hide internal directories.