Documentation ¶
Index ¶
- func GetSyslogPriority(props map[string]string) syslog.Priority
- func ParseSysLogConfig(config string) (protocol string, host string, port int, err error)
- func SplitFileNames(fileNames string) []string
- func ToSyslogFacility(facility string) syslog.Priority
- func ToSyslogLevel(logLevel string) syslog.Priority
- type BackendSysLogWriter
- type ChanLogger
- func (that *ChanLogger) ClearAllLogFile() error
- func (that *ChanLogger) ClearCurLogFile() error
- func (that *ChanLogger) Close() error
- func (that *ChanLogger) ReadLog(_ int64, _ int64) (string, error)
- func (that *ChanLogger) ReadTailLog(_ int64, _ int64) (string, int64, bool, error)
- func (that *ChanLogger) SetPid(_ int)
- func (that *ChanLogger) Write(p []byte) (int, error)
- type CompositeLogger
- func (that *CompositeLogger) AddLogger(logger Logger)
- func (that *CompositeLogger) ClearAllLogFile() error
- func (that *CompositeLogger) ClearCurLogFile() error
- func (that *CompositeLogger) Close() (err error)
- func (that *CompositeLogger) ReadLog(offset int64, length int64) (string, error)
- func (that *CompositeLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (that *CompositeLogger) RemoveLogger(logger Logger)
- func (that *CompositeLogger) SetPid(pid int)
- func (that *CompositeLogger) Write(p []byte) (n int, err error)
- type FileLogger
- func (that *FileLogger) BackupFiles()
- func (that *FileLogger) ClearAllLogFile() error
- func (that *FileLogger) ClearCurLogFile() error
- func (that *FileLogger) Close() error
- func (that *FileLogger) OpenFile(trunc bool) error
- func (that *FileLogger) ReadLog(offset int64, length int64) (string, error)
- func (that *FileLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (that *FileLogger) SetPid(pid int)
- func (that *FileLogger) Write(p []byte) (int, error)
- type Logger
- type NullLocker
- type NullLogger
- func (that *NullLogger) ClearAllLogFile() error
- func (that *NullLogger) ClearCurLogFile() error
- func (that *NullLogger) Close() error
- func (that *NullLogger) ReadLog(offset int64, length int64) (string, error)
- func (that *NullLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (that *NullLogger) SetPid(pid int)
- func (that *NullLogger) Write(p []byte) (int, error)
- type StdLogger
- type SysLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseSysLogConfig ¶
parse the configuration for syslog, it should be in following format: [protocol:]host[:port]
- protocol, could be tcp or udp, assuming udp as default - port, if missing, by default for tcp is 6514 and for udp - 514
func SplitFileNames ¶
func ToSyslogFacility ¶
func ToSyslogLevel ¶
Types ¶
type BackendSysLogWriter ¶
type BackendSysLogWriter struct {
// contains filtered or unexported fields
}
func NewBackendSysLogWriter ¶
func NewBackendSysLogWriter(network, raddr string, priority syslog.Priority, tag string) *BackendSysLogWriter
NewBackendSysLogWriter creates background syslog writer
func (*BackendSysLogWriter) Close ¶
func (bs *BackendSysLogWriter) Close() error
Close background write channel
type ChanLogger ¶
type ChanLogger struct {
// contains filtered or unexported fields
}
func NewChanLogger ¶
func NewChanLogger(channel chan []byte) *ChanLogger
func (*ChanLogger) ClearAllLogFile ¶
func (that *ChanLogger) ClearAllLogFile() error
func (*ChanLogger) ClearCurLogFile ¶
func (that *ChanLogger) ClearCurLogFile() error
func (*ChanLogger) Close ¶
func (that *ChanLogger) Close() error
func (*ChanLogger) ReadTailLog ¶
func (*ChanLogger) SetPid ¶
func (that *ChanLogger) SetPid(_ int)
type CompositeLogger ¶
type CompositeLogger struct {
// contains filtered or unexported fields
}
复合日志类型
func NewCompositeLogger ¶
func NewCompositeLogger(loggers []Logger) *CompositeLogger
func (*CompositeLogger) AddLogger ¶
func (that *CompositeLogger) AddLogger(logger Logger)
func (*CompositeLogger) ClearAllLogFile ¶
func (that *CompositeLogger) ClearAllLogFile() error
ClearAllLogFile clear all the files of first logger in CompositeLogger pool
func (*CompositeLogger) ClearCurLogFile ¶
func (that *CompositeLogger) ClearCurLogFile() error
ClearCurLogFile clear the first logger file in CompositeLogger pool
func (*CompositeLogger) Close ¶
func (that *CompositeLogger) Close() (err error)
func (*CompositeLogger) ReadLog ¶
func (that *CompositeLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read log data from first logger in CompositeLogger pool
func (*CompositeLogger) ReadTailLog ¶
ReadTailLog tail the log data from first logger in CompositeLogger pool
func (*CompositeLogger) RemoveLogger ¶
func (that *CompositeLogger) RemoveLogger(logger Logger)
func (*CompositeLogger) SetPid ¶
func (that *CompositeLogger) SetPid(pid int)
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger 写入stdout/stderr到文件
func NewFileLogger ¶
func (*FileLogger) ClearAllLogFile ¶
func (that *FileLogger) ClearAllLogFile() error
ClearAllLogFile 清除所有日志文件,包括保留的备份
func (*FileLogger) ClearCurLogFile ¶
func (that *FileLogger) ClearCurLogFile() error
ClearCurLogFile 清除当前日志文件
func (*FileLogger) ReadLog ¶
func (that *FileLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog 读取日志
func (*FileLogger) ReadTailLog ¶
ReadTailLog 读取尾部日志
func (*FileLogger) SetPid ¶
func (that *FileLogger) SetPid(pid int)
type Logger ¶
type Logger interface { io.WriteCloser SetPid(pid int) ReadLog(offset int64, length int64) (string, error) ReadTailLog(offset int64, length int64) (string, int64, bool, error) ClearCurLogFile() error ClearAllLogFile() error }
Logger 日志接口
type NullLocker ¶
type NullLocker struct{}
func NewNullLocker ¶
func NewNullLocker() *NullLocker
func (*NullLocker) Lock ¶
func (that *NullLocker) Lock()
func (*NullLocker) Unlock ¶
func (that *NullLocker) Unlock()
type NullLogger ¶
type NullLogger struct { }
func NewNullLogger ¶
func NewNullLogger() *NullLogger
func (*NullLogger) ClearAllLogFile ¶
func (that *NullLogger) ClearAllLogFile() error
func (*NullLogger) ClearCurLogFile ¶
func (that *NullLogger) ClearCurLogFile() error
func (*NullLogger) Close ¶
func (that *NullLogger) Close() error
func (*NullLogger) ReadLog ¶
func (that *NullLogger) ReadLog(offset int64, length int64) (string, error)
func (*NullLogger) ReadTailLog ¶
func (*NullLogger) SetPid ¶
func (that *NullLogger) SetPid(pid int)
type StdLogger ¶
type StdLogger struct { NullLogger // contains filtered or unexported fields }
func NewStderrLogger ¶
func NewStderrLogger() *StdLogger
func NewStdoutLogger ¶
func NewStdoutLogger() *StdLogger
type SysLogger ¶
type SysLogger struct { NullLogger // contains filtered or unexported fields }
func NewRemoteSysLogger ¶
NewRemoteSysLogger 获取远程系统日志的对象
func NewSysLogger ¶
NewSysLogger 获取系统syslog的对象