Documentation ¶
Index ¶
- Variables
- type Backend
- type Logger
- func (l *Logger) AddBackend(b Backend) bool
- func (l *Logger) AddBackendConsole() bool
- func (l *Logger) AddBackendSyslog() bool
- func (l *Logger) AddExtArgForRestart(arg string)
- func (l *Logger) BeginTracing()
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) EndTracing()
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) GetLogLevel() Priority
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) RemoveBackend(b Backend)
- func (l *Logger) RemoveBackendConsole()
- func (l *Logger) RemoveBackendSyslog()
- func (l *Logger) ResetBackends()
- func (l *Logger) SetLogLevel(level Priority) *Logger
- func (l *Logger) SetRestartCommand(exefile string, args ...string)
- func (l *Logger) Warning(v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
- type Priority
Constants ¶
This section is empty.
Variables ¶
var ( // DebugEnv is the name of environment variable that used to // enable debug mode , if exists the default log level will be // "LevelDebug". DebugEnv = defaultDebugEnv // DebugLevelEnv is the name of environment variable that used to // control the log level, could be "debug", "info", "warning", // "error", "fatal" and "disable". DebugLevelEnv = defaultDebugLelveEnv // DebugMatchEnv is the name of environment variable that used to // enable debug mode for target logger object. DebugMatchEnv = defaultDebugMatchEnv // DebugFile if the file name that if exist the default log level // will be "LevelDebug". DebugFile = defaultDebugFile )
var ( // DebugConsoleEnv is the name of environment variable that used to control // the console backend print log in syslog format. DebugConsoleEnv = defaultDebugConsoleEnv )
var ( // SyslogTagPrefix define the prefix of syslog tag, default is // empty. SyslogTagPrefix = defaultSyslogTagPrefix )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// contains filtered or unexported methods
}
Backend defines interface of logger's back-ends.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a wrapper object to access Logger dbus service.
func NewLogger ¶
NewLogger create a Logger object, which need a string as name to register Logger dbus service, if the environment variable exists which name stores in variable "DebugEnv", the default log level will be "LevelDebug" or is "LevelInfo".
func (*Logger) AddBackend ¶
AddBackend append a log back-end.
func (*Logger) AddBackendConsole ¶
AddBackendConsole append a console back-end.
func (*Logger) AddBackendSyslog ¶
AddBackendSyslog append a syslog back-end.
func (*Logger) AddExtArgForRestart ¶
AddExtArgForRestart add the command option which be used when process fataled and restart by Logger dbus service.
func (*Logger) BeginTracing ¶
func (l *Logger) BeginTracing()
BeginTracing log function information when entering it.
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug log a message in "debug" level.
func (*Logger) Debugf ¶
Debugf formats message according to a format specifier and log it in "debug" level.
func (*Logger) EndTracing ¶
func (l *Logger) EndTracing()
EndTracing log function information when leaving it.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error log a message in "error" level.
func (*Logger) Errorf ¶
Errorf formats message according to a format specifier and log it in "error" level.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal is equivalent to Error() followed by a call to os.Exit(1).
func (*Logger) GetLogLevel ¶
GetLogLevel return the log level.
func (*Logger) Infof ¶
Infof formats message according to a format specifier and log it in "info" level.
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic is equivalent to Error() followed by a call to panic().
func (*Logger) RemoveBackend ¶
RemoveBackend remove all back-end with target type.
func (*Logger) RemoveBackendConsole ¶
func (l *Logger) RemoveBackendConsole()
RemoveBackendConsole remove all console back-end.
func (*Logger) RemoveBackendSyslog ¶
func (l *Logger) RemoveBackendSyslog()
RemoveBackendSyslog remove all console back-end.
func (*Logger) SetLogLevel ¶
SetLogLevel reset the log level.
func (*Logger) SetRestartCommand ¶
SetRestartCommand reset the command and argument when restart after fatal.