Documentation ¶
Index ¶
- Constants
- func NewConn() logger
- func NewConsole() logger
- func Register(name string, log newLoggerFunc)
- type Logger
- func (bl *Logger) Alert(f interface{}, v ...interface{})
- func (bl *Logger) Async(msgLen ...int64) *Logger
- func (bl *Logger) Close()
- func (bl *Logger) Critical(f interface{}, v ...interface{})
- func (bl *Logger) Debug(f interface{}, v ...interface{})
- func (bl *Logger) DelLogger(adapterName string) error
- func (bl *Logger) Emergency(f interface{}, v ...interface{})
- func (bl *Logger) EnableFuncCallDepth(b bool)
- func (bl *Logger) Error(f interface{}, v ...interface{})
- func (bl *Logger) Flush()
- func (bl *Logger) GetLevel() int
- func (bl *Logger) GetLogFuncCallDepth() int
- func (bl *Logger) Info(f interface{}, v ...interface{})
- func (bl *Logger) Informational(f interface{}, v ...interface{})
- func (bl *Logger) Notice(f interface{}, v ...interface{})
- func (bl *Logger) Reset()
- func (bl *Logger) SetLevel(l int)
- func (bl *Logger) SetLogFuncCallDepth(d int)
- func (bl *Logger) SetLogger(adapterName string, configs ...string) error
- func (bl *Logger) SetPrefix(s string)
- func (bl *Logger) Trace(f interface{}, v ...interface{})
- func (bl *Logger) Warn(f interface{}, v ...interface{})
- func (bl *Logger) Warning(f interface{}, v ...interface{})
- func (bl *Logger) Write(p []byte) (n int, err error)
Constants ¶
const ( LevelEmergency = iota LevelAlert LevelCritical LevelError LevelWarning LevelNotice LevelInformational LevelDebug )
RFC5424 log message levels.
const ( AdapterConsole = "console" AdapterFile = "file" AdapterMultiFile = "multi_file" AdapterConn = "conn" )
Name for adapter
const ( LevelInfo = LevelInformational LevelTrace = LevelDebug LevelWarn = LevelWarning )
Legacy log level constants to ensure backwards compatibility.
Variables ¶
This section is empty.
Functions ¶
func NewConsole ¶
func NewConsole() logger
NewConsole create ConsoleWriter returning as LoggerInterface.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is default logger. it can contain several providers and log message into all providers.
func NewLogger ¶
NewLogger returns a new Logger. channelLen means the number of messages in chan(used where asynchronous is true). if the buffering chan is full, logger adapters write to file or other way.
func (*Logger) Alert ¶
func (bl *Logger) Alert(f interface{}, v ...interface{})
Alert Log ALERT level message.
func (*Logger) Close ¶
func (bl *Logger) Close()
Close close logger, flush all chan data and destroy all adapters in Logger.
func (*Logger) Critical ¶
func (bl *Logger) Critical(f interface{}, v ...interface{})
Critical Log CRITICAL level message.
func (*Logger) Debug ¶
func (bl *Logger) Debug(f interface{}, v ...interface{})
Debug Log DEBUG level message.
func (*Logger) Emergency ¶
func (bl *Logger) Emergency(f interface{}, v ...interface{})
Emergency Log EMERGENCY level message.
func (*Logger) EnableFuncCallDepth ¶
EnableFuncCallDepth enable log funcCallDepth
func (*Logger) Error ¶
func (bl *Logger) Error(f interface{}, v ...interface{})
Error Log ERROR level message.
func (*Logger) GetLogFuncCallDepth ¶
GetLogFuncCallDepth return log funcCallDepth for wrapper
func (*Logger) Info ¶
func (bl *Logger) Info(f interface{}, v ...interface{})
Info Log INFO level message. compatibility alias for Informational()
func (*Logger) Informational ¶
func (bl *Logger) Informational(f interface{}, v ...interface{})
Informational Log INFORMATIONAL level message.
func (*Logger) Notice ¶
func (bl *Logger) Notice(f interface{}, v ...interface{})
Notice Log NOTICE level message.
func (*Logger) SetLevel ¶
SetLevel Set log message level. If message level (such as LevelDebug) is higher than logger level (such as LevelWarning), log providers will not even be sent the message.
func (*Logger) SetLogFuncCallDepth ¶
SetLogFuncCallDepth set log funcCallDepth
func (*Logger) SetLogger ¶
SetLogger provides a given logger adapter into Logger with config string. config need to be correct JSON as string: {"interval":360}.
func (*Logger) Trace ¶
func (bl *Logger) Trace(f interface{}, v ...interface{})
Trace Log TRACE level message. compatibility alias for Debug()
func (*Logger) Warn ¶
func (bl *Logger) Warn(f interface{}, v ...interface{})
Warn Log WARN level message. compatibility alias for Warning()