Documentation ¶
Index ¶
- type BackendSysLogWriter
- type BackgroundWriteCloser
- type ChanLogger
- func (l *ChanLogger) ClearAllLogFile() error
- func (l *ChanLogger) ClearCurLogFile() error
- func (l *ChanLogger) Close() error
- func (l *ChanLogger) ReadLog(offset int64, length int64) (string, error)
- func (l *ChanLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (l *ChanLogger) SetPid(pid int)
- func (l *ChanLogger) Write(p []byte) (int, error)
- type CompositeLogger
- func (cl *CompositeLogger) AddLogger(logger Logger)
- func (cl *CompositeLogger) ClearAllLogFile() error
- func (cl *CompositeLogger) ClearCurLogFile() error
- func (cl *CompositeLogger) Close() (err error)
- func (cl *CompositeLogger) ReadLog(offset int64, length int64) (string, error)
- func (cl *CompositeLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (cl *CompositeLogger) RemoveLogger(logger Logger)
- func (cl *CompositeLogger) SetPid(pid int)
- func (cl *CompositeLogger) Write(p []byte) (n int, err error)
- type FileLogger
- func (l *FileLogger) ClearAllLogFile() error
- func (l *FileLogger) ClearCurLogFile() error
- func (l *FileLogger) Close() error
- func (l *FileLogger) ReadLog(offset int64, length int64) (string, error)
- func (l *FileLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (l *FileLogger) SetPid(pid int)
- func (l *FileLogger) Write(p []byte) (int, error)
- type LogCaptureLogger
- func (l *LogCaptureLogger) ClearAllLogFile() error
- func (l *LogCaptureLogger) ClearCurLogFile() error
- func (l *LogCaptureLogger) Close() error
- func (l *LogCaptureLogger) ReadLog(offset int64, length int64) (string, error)
- func (l *LogCaptureLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (l *LogCaptureLogger) SetPid(pid int)
- func (l *LogCaptureLogger) Write(p []byte) (int, error)
- type LogEventEmitter
- type Logger
- type NullLocker
- type NullLogEventEmitter
- type NullLogger
- func (l *NullLogger) ClearAllLogFile() error
- func (l *NullLogger) ClearCurLogFile() error
- func (l *NullLogger) Close() error
- func (l *NullLogger) ReadLog(offset int64, length int64) (string, error)
- func (l *NullLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)
- func (l *NullLogger) SetPid(pid int)
- func (l *NullLogger) Write(p []byte) (int, error)
- type StdLogEventEmitter
- type StdLogger
- type SysLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendSysLogWriter ¶
type BackendSysLogWriter struct {
// contains filtered or unexported fields
}
BackendSysLogWriter a syslog writer to write the log to syslog in background
func NewBackendSysLogWriter ¶
func NewBackendSysLogWriter(network, raddr string, priority syslog.Priority, tag string) *BackendSysLogWriter
NewBackendSysLogWriter create a background running syslog writer
func (*BackendSysLogWriter) Close ¶
func (bs *BackendSysLogWriter) Close() error
Close close the backgroup write channel
type BackgroundWriteCloser ¶
type BackgroundWriteCloser struct { io.WriteCloser // contains filtered or unexported fields }
BackgroundWriteCloser write data in background
func NewBackgroundWriteCloser ¶
func NewBackgroundWriteCloser(writeCloser io.WriteCloser) *BackgroundWriteCloser
NewBackgroundWriteCloser create a new BackgroundWriteCloser object
func (*BackgroundWriteCloser) Close ¶
func (bw *BackgroundWriteCloser) Close() error
Close close the background data channel
type ChanLogger ¶
type ChanLogger struct {
// contains filtered or unexported fields
}
ChanLogger write log message by channel
func NewChanLogger ¶
func NewChanLogger(channel chan []byte) *ChanLogger
NewChanLogger create a ChanLogger object
func (*ChanLogger) ClearAllLogFile ¶
func (l *ChanLogger) ClearAllLogFile() error
ClearAllLogFile clear the log, return error
func (*ChanLogger) ClearCurLogFile ¶
func (l *ChanLogger) ClearCurLogFile() error
ClearCurLogFile clear the log, return error
func (*ChanLogger) ReadLog ¶
func (l *ChanLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read log, return error
func (*ChanLogger) ReadTailLog ¶
ReadTailLog tail the log, return error
type CompositeLogger ¶
type CompositeLogger struct {
// contains filtered or unexported fields
}
CompositeLogger dispatch the log message to other loggers
func NewCompositeLogger ¶
func NewCompositeLogger(loggers []Logger) *CompositeLogger
NewCompositeLogger create a new CompositeLogger object
func (*CompositeLogger) AddLogger ¶
func (cl *CompositeLogger) AddLogger(logger Logger)
AddLogger add a logger to receive the log data
func (*CompositeLogger) ClearAllLogFile ¶
func (cl *CompositeLogger) ClearAllLogFile() error
ClearAllLogFile clear all the files of first logger
func (*CompositeLogger) ClearCurLogFile ¶
func (cl *CompositeLogger) ClearCurLogFile() error
ClearCurLogFile clear the first logger file
func (*CompositeLogger) Close ¶
func (cl *CompositeLogger) Close() (err error)
Close close all the loggers added by AddLogger() call
func (*CompositeLogger) ReadLog ¶
func (cl *CompositeLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read log data from first logger
func (*CompositeLogger) ReadTailLog ¶
ReadTailLog tail the log data from first logger
func (*CompositeLogger) RemoveLogger ¶
func (cl *CompositeLogger) RemoveLogger(logger Logger)
RemoveLogger remove the previous added logger
func (*CompositeLogger) SetPid ¶
func (cl *CompositeLogger) SetPid(pid int)
SetPid set pid to all the loggers added by AddLogger() call
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger log program stdout/stderr to file
func NewFileLogger ¶
func NewFileLogger(name string, maxSize int64, backups int, logEventEmitter LogEventEmitter, locker sync.Locker) *FileLogger
NewFileLogger create a FileLogger object
func (*FileLogger) ClearAllLogFile ¶
func (l *FileLogger) ClearAllLogFile() error
ClearAllLogFile clear all the log files
func (*FileLogger) ClearCurLogFile ¶
func (l *FileLogger) ClearCurLogFile() error
ClearCurLogFile clear the current log file contents
func (*FileLogger) ReadLog ¶
func (l *FileLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read the log from current logfile
func (*FileLogger) ReadTailLog ¶
ReadTailLog tail the log of current log file
type LogCaptureLogger ¶
type LogCaptureLogger struct {
// contains filtered or unexported fields
}
LogCaptureLogger capture the log for further analysis
func NewLogCaptureLogger ¶
func NewLogCaptureLogger(underlineLogger Logger, captureMaxBytes int, stdType string, procName string, groupName string) *LogCaptureLogger
NewLogCaptureLogger create a new LogCaptureLogger object
func (*LogCaptureLogger) ClearAllLogFile ¶
func (l *LogCaptureLogger) ClearAllLogFile() error
ClearAllLogFile clear all the log files
func (*LogCaptureLogger) ClearCurLogFile ¶
func (l *LogCaptureLogger) ClearCurLogFile() error
ClearCurLogFile clear the current log file
func (*LogCaptureLogger) ReadLog ¶
func (l *LogCaptureLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read the log
func (*LogCaptureLogger) ReadTailLog ¶
ReadTailLog tail the log
func (*LogCaptureLogger) SetPid ¶
func (l *LogCaptureLogger) SetPid(pid int)
SetPid set the pid of program
type LogEventEmitter ¶
type LogEventEmitter interface {
// contains filtered or unexported methods
}
LogEventEmitter the interface to emit log events
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 the log interface to log program stdout/stderr logs to file
type NullLogEventEmitter ¶
type NullLogEventEmitter struct { }
NullLogEventEmitter will not emit log to any listener
func NewNullLogEventEmitter ¶
func NewNullLogEventEmitter() *NullLogEventEmitter
NewNullLogEventEmitter create a new NullLogEventEmitter object
type NullLogger ¶
type NullLogger struct {
// contains filtered or unexported fields
}
NullLogger discard the program stdout/stderr log
func NewNullLogger ¶
func NewNullLogger(logEventEmitter LogEventEmitter) *NullLogger
NewNullLogger create a NullLoger
func (*NullLogger) ClearAllLogFile ¶
func (l *NullLogger) ClearAllLogFile() error
ClearAllLogFile clear all the lof file, return error
func (*NullLogger) ClearCurLogFile ¶
func (l *NullLogger) ClearCurLogFile() error
ClearCurLogFile close current log file, return error
func (*NullLogger) ReadLog ¶
func (l *NullLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog read the log, return error
func (*NullLogger) ReadTailLog ¶
ReadTailLog tail the log, return error
type StdLogEventEmitter ¶
type StdLogEventEmitter struct { Type string // contains filtered or unexported fields }
StdLogEventEmitter emit the Stdout/Stderr LogEvent
func NewStderrLogEventEmitter ¶
func NewStderrLogEventEmitter(processName string, groupName string, procPidFunc func() int) *StdLogEventEmitter
NewStderrLogEventEmitter create a new StdLogEventEmitter object for emit the Stderr log
func NewStdoutLogEventEmitter ¶
func NewStdoutLogEventEmitter(processName string, groupName string, procPidFunc func() int) *StdLogEventEmitter
NewStdoutLogEventEmitter create a new StdLogEventEmitter object
type StdLogger ¶
type StdLogger struct { NullLogger // contains filtered or unexported fields }
StdLogger stdout/stderr logger implementation
func NewStderrLogger ¶
func NewStderrLogger(logEventEmitter LogEventEmitter) *StdLogger
NewStderrLogger create a stderr logger
func NewStdoutLogger ¶
func NewStdoutLogger(logEventEmitter LogEventEmitter) *StdLogger
NewStdoutLogger create a StdLogger object
type SysLogger ¶
type SysLogger struct { NullLogger // contains filtered or unexported fields }
SysLogger log program stdout/stderr to syslog
func NewRemoteSysLogger ¶
func NewRemoteSysLogger(name string, config string, logEventEmitter LogEventEmitter) *SysLogger
NewRemoteSysLogger create a network syslog
func NewSysLogger ¶
func NewSysLogger(name string, logEventEmitter LogEventEmitter) *SysLogger
NewSysLogger create a local syslog