53 lines
795 B
Go
53 lines
795 B
Go
package logging
|
|
|
|
import (
|
|
`log`
|
|
`log/syslog`
|
|
`os`
|
|
)
|
|
|
|
type Logger interface {
|
|
Alert(string, ...interface{}) error
|
|
Crit(string, ...interface{}) error
|
|
Debug(string, ...interface{}) error
|
|
Emerg(string, ...interface{}) error
|
|
Err(string, ...interface{}) error
|
|
Info(string, ...interface{}) error
|
|
Notice(string, ...interface{}) error
|
|
Warning(string, ...interface{}) error
|
|
doDebug(bool)
|
|
setPrefix(string)
|
|
Setup()
|
|
Shutdown()
|
|
}
|
|
|
|
type SystemDLogger struct {
|
|
EnableDebug bool
|
|
Prefix string
|
|
}
|
|
|
|
type SyslogLogger struct {
|
|
EnableDebug bool
|
|
Prefix string
|
|
alert,
|
|
crit,
|
|
debug,
|
|
emerg,
|
|
err,
|
|
info,
|
|
notice,
|
|
warning *syslog.Writer
|
|
}
|
|
|
|
type StdLogger struct {
|
|
*log.Logger
|
|
EnableDebug bool
|
|
Prefix string
|
|
}
|
|
|
|
type FileLogger struct {
|
|
StdLogger
|
|
Path string
|
|
writer *os.File
|
|
}
|