Documentation ¶
Index ¶
- Constants
- func Close() (e error)
- func Critical(message ...interface{})
- func CriticalFormat(format string, message ...interface{})
- func Debug(message ...interface{})
- func DebugFormat(format string, message ...interface{})
- func Emergency(message ...interface{})
- func EmergencyFormat(format string, message ...interface{})
- func Error(message ...interface{})
- func ErrorFormat(format string, message ...interface{})
- func ForceStart(config LogConfigInterface)
- func Info(message ...interface{})
- func InfoFormat(format string, message ...interface{})
- func LevelToInt(level string) uint8
- func LevelToString(level uint8) string
- func LimitString(input string) string
- func Log(level uint8, message ...interface{})
- func LogFormat(level uint8, format string, message ...interface{})
- func NewFileLogger(config LogConfigInterface) (file *fileLogger)
- func NewNullLogger(config LogConfigInterface) (null *nullLogger)
- func NewStderrLogger(config LogConfigInterface) (stderr *stderrLogger)
- func NewSyslogLogger(config LogConfigInterface) (sys *syslogLogger)
- func Notice(message ...interface{})
- func NoticeFormat(format string, message ...interface{})
- func Panic(message ...interface{})
- func PanicFormat(format string, message ...interface{})
- func SanitizeString(input string) string
- func Start(config LogConfigInterface) (e error)
- func StartEarly()
- func Warning(message ...interface{})
- func WarningFormat(format string, message ...interface{})
- type DefaultConfig
- func (config *DefaultConfig) GetEHandler() func(name string, e error)
- func (config *DefaultConfig) GetLevel() uint8
- func (config *DefaultConfig) GetName() string
- func (config *DefaultConfig) GetType() Type
- func (config *DefaultConfig) HandleE(name string, e error)
- func (config *DefaultConfig) IsPlain() bool
- func (config *DefaultConfig) SetEHandler(to func(name string, e error))
- func (config *DefaultConfig) SetLevel(to uint8)
- func (config *DefaultConfig) TogglePlain()
- type DefaultFileConfig
- type LogConfigInterface
- type Type
Constants ¶
const ( TIME_FORMAT = "2006-01-02T15:04:05Z07:00" DATE_FORMAT = "2006-01-02" CLOCK_FORMAT = "15:04:05" // cannot continue, aborting immidiatly EMERGENCY = 0x01 EMERGENCY_SYSLOG = 1 // require immidiate attention CRITICAL = 0x02 CRITICAL_SYSLOG = 2 // not used ALERT = CRITICAL ALERT_SYSLOG = 3 // an error that was recovered ERROR = 0x04 ERROR_SYSLOG = 4 // warning. space nearly full etc. WARNING = 0x08 WARNING_SYSLOG = 5 // notice. behaviour will change, found this driver etc. NOTICE = 0x16 NOTICE_SYSLOG = 6 // info. version info, something succeded etc. INFO = 0x32 INFO_SYSLOG = 7 // debug. favourite time of programming DEBUG = 0x64 DEBUG_SYSLOG = 8 // EMERGENCY & CRITICAL FATAL = 0x03 // FATAL & ERROR ERRORS = 0x07 // ERRORS & WARNING WARNINGS = 0x15 // WARNINGS & NOTICE VERBOSE = 0x31 // VERBOSE & INFO ATTENTION = 0x63 // VERBOSE & DEBUG DEBUGGING = 0x7f // max EVERYTHING = 0xff )
Variables ¶
This section is empty.
Functions ¶
func CriticalFormat ¶
func CriticalFormat(format string, message ...interface{})
require immidiate attention
func DebugFormat ¶
func DebugFormat(format string, message ...interface{})
debug, favourite time of programming
func EmergencyFormat ¶
func EmergencyFormat(format string, message ...interface{})
cannot continue, aborting immidiatly
func ErrorFormat ¶
func ErrorFormat(format string, message ...interface{})
an error that was recovered
func InfoFormat ¶
func InfoFormat(format string, message ...interface{})
info: version info, something succeded etc.
func LevelToInt ¶
func LevelToString ¶
func LimitString ¶
func Log ¶
func Log(level uint8, message ...interface{})
DEPRECATED log a message; call Start() first.
func NewFileLogger ¶
func NewFileLogger(config LogConfigInterface) (file *fileLogger)
func NewNullLogger ¶
func NewNullLogger(config LogConfigInterface) (null *nullLogger)
func NewStderrLogger ¶
func NewStderrLogger(config LogConfigInterface) (stderr *stderrLogger)
func NewSyslogLogger ¶
func NewSyslogLogger(config LogConfigInterface) (sys *syslogLogger)
func Notice ¶
func Notice(message ...interface{})
notice: behaviour will change, found this driver etc.
func NoticeFormat ¶
func NoticeFormat(format string, message ...interface{})
notice: behaviour will change, found this driver etc.
func PanicFormat ¶
func PanicFormat(format string, message ...interface{})
log with EMERGENCY and then panic with the message with format
func SanitizeString ¶
generic string sanitizing specific sanitizing must still be done in specific loggers
func Start ¶
func Start(config LogConfigInterface) (e error)
start logging; flushes early log from StartEarly()
func StartEarly ¶
func StartEarly()
log to memory first, as this requires no real configuration. Start() will flush this logger to the actual logger
func WarningFormat ¶
func WarningFormat(format string, message ...interface{})
warning: space nearly full etc.
Types ¶
type DefaultConfig ¶
type DefaultConfig struct { // program name Name string // type of logger TODO LogType Type // log level Level uint8 // error handler (name string, e error) EHandler func(string, error) // contains filtered or unexported fields }
func NewDefaultConfig ¶
func NewDefaultConfig() (config *DefaultConfig)
func (*DefaultConfig) GetEHandler ¶
func (config *DefaultConfig) GetEHandler() func(name string, e error)
func (*DefaultConfig) GetLevel ¶
func (config *DefaultConfig) GetLevel() uint8
func (*DefaultConfig) GetName ¶
func (config *DefaultConfig) GetName() string
func (*DefaultConfig) GetType ¶
func (config *DefaultConfig) GetType() Type
func (*DefaultConfig) HandleE ¶
func (config *DefaultConfig) HandleE(name string, e error)
func (*DefaultConfig) IsPlain ¶
func (config *DefaultConfig) IsPlain() bool
func (*DefaultConfig) SetEHandler ¶
func (config *DefaultConfig) SetEHandler(to func(name string, e error))
func (*DefaultConfig) SetLevel ¶
func (config *DefaultConfig) SetLevel(to uint8)
func (*DefaultConfig) TogglePlain ¶
func (config *DefaultConfig) TogglePlain()
type DefaultFileConfig ¶
type DefaultFileConfig struct { DefaultConfig Path string }
func NewDefaultFileConfig ¶
func NewDefaultFileConfig() (config *DefaultFileConfig)
func (*DefaultFileConfig) GetPath ¶
func (config *DefaultFileConfig) GetPath() string
type LogConfigInterface ¶
type LogConfigInterface interface { // name of you program GetName() string // main log type (null, stderr, file, syslog ...) GetType() Type // additional loggers //GetSecondaryTypes() []string // verbosity, see tools.go:LevelToString GetLevel() uint8 SetLevel(to uint8) // error handling GetEHandler() func(string, error) SetEHandler(to func(string, error)) HandleE(string, error) // plain mode (no colors, no highlights etc) IsPlain() bool // set to plain mode (default: false) TogglePlain() }
configuration