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 creates background syslog writer
func (*BackendSysLogWriter) Close ¶
func (bs *BackendSysLogWriter) Close() error
Close background 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 creates new BackgroundWriteCloser object
func (*BackgroundWriteCloser) Close ¶
func (bw *BackgroundWriteCloser) Close() error
Close 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 creates ChanLogger object
func (*ChanLogger) ClearAllLogFile ¶
func (l *ChanLogger) ClearAllLogFile() error
ClearAllLogFile returns error for ChanLogger
func (*ChanLogger) ClearCurLogFile ¶
func (l *ChanLogger) ClearCurLogFile() error
ClearCurLogFile returns error for ChanLogger
func (*ChanLogger) ReadLog ¶
func (l *ChanLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog returns error for ChanLogger
func (*ChanLogger) ReadTailLog ¶
ReadTailLog returns error for ChanLogger
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 creates new CompositeLogger object (pool of loggers)
func (*CompositeLogger) AddLogger ¶
func (cl *CompositeLogger) AddLogger(logger Logger)
AddLogger adds logger to CompositeLogger pool
func (*CompositeLogger) ClearAllLogFile ¶
func (cl *CompositeLogger) ClearAllLogFile() error
ClearAllLogFile clear all the files of first logger in CompositeLogger pool
func (*CompositeLogger) ClearCurLogFile ¶
func (cl *CompositeLogger) ClearCurLogFile() error
ClearCurLogFile clear the first logger file in CompositeLogger pool
func (*CompositeLogger) Close ¶
func (cl *CompositeLogger) Close() (err error)
Close all loggers in CompositeLogger pool
func (*CompositeLogger) ReadLog ¶
func (cl *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 (cl *CompositeLogger) RemoveLogger(logger Logger)
RemoveLogger removes logger from CompositeLogger pool
func (*CompositeLogger) SetPid ¶
func (cl *CompositeLogger) SetPid(pid int)
SetPid sets pid to all loggers in CompositeLogger pool
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 creates FileLogger object
func (*FileLogger) ClearAllLogFile ¶
func (l *FileLogger) ClearAllLogFile() error
ClearAllLogFile clears contents of all log files (re-open with truncate)
func (*FileLogger) ClearCurLogFile ¶
func (l *FileLogger) ClearCurLogFile() error
ClearCurLogFile clears contents (re-open with truncate) of current log file
func (*FileLogger) ReadLog ¶
func (l *FileLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog reads log from current logfile
func (*FileLogger) ReadTailLog ¶
ReadTailLog tails 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 creates new LogCaptureLogger object
func (*LogCaptureLogger) ClearAllLogFile ¶
func (l *LogCaptureLogger) ClearAllLogFile() error
ClearAllLogFile clears all log files
func (*LogCaptureLogger) ClearCurLogFile ¶
func (l *LogCaptureLogger) ClearCurLogFile() error
ClearCurLogFile clears current log file
func (*LogCaptureLogger) ReadLog ¶
func (l *LogCaptureLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog reads log from LogCaptureLogger
func (*LogCaptureLogger) ReadTailLog ¶
ReadTailLog tails log from LogCaptureLogger
func (*LogCaptureLogger) SetPid ¶
func (l *LogCaptureLogger) SetPid(pid int)
SetPid sets 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 creates 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 creates NullLogger object
func (*NullLogger) ClearAllLogFile ¶
func (l *NullLogger) ClearAllLogFile() error
ClearAllLogFile returns error for NullLogger
func (*NullLogger) ClearCurLogFile ¶
func (l *NullLogger) ClearCurLogFile() error
ClearCurLogFile returns error for NullLogger
func (*NullLogger) ReadLog ¶
func (l *NullLogger) ReadLog(offset int64, length int64) (string, error)
ReadLog returns error for NullLogger
func (*NullLogger) ReadTailLog ¶
ReadTailLog returns error for NullLogger
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 creates new StdLogEventEmitter object for emitting Stderr log events
func NewStdoutLogEventEmitter ¶
func NewStdoutLogEventEmitter(processName string, groupName string, procPidFunc func() int) *StdLogEventEmitter
NewStdoutLogEventEmitter creates 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 creates stderr logger
func NewStdoutLogger ¶
func NewStdoutLogger(logEventEmitter LogEventEmitter) *StdLogger
NewStdoutLogger creates 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, props map[string]string, logEventEmitter LogEventEmitter) *SysLogger
NewRemoteSysLogger creates network syslog logger object
func NewSysLogger ¶
func NewSysLogger(name string, props map[string]string, logEventEmitter LogEventEmitter) *SysLogger
NewSysLogger creates local syslog