logger

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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
}

func NewBackendSysLogWriter

func NewBackendSysLogWriter(network, raddr string, priority syslog.Priority, tag string) *BackendSysLogWriter

create a backgroud running syslog writer

func (*BackendSysLogWriter) Close

func (bs *BackendSysLogWriter) Close() error

func (*BackendSysLogWriter) Write

func (bs *BackendSysLogWriter) Write(b []byte) (int, error)

write data to the backend syslog writer

type BackgroundWriteCloser

type BackgroundWriteCloser struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

func NewBackgroundWriteCloser

func NewBackgroundWriteCloser(writeCloser io.WriteCloser) *BackgroundWriteCloser

func (*BackgroundWriteCloser) Close

func (bw *BackgroundWriteCloser) Close() error

func (*BackgroundWriteCloser) Write

func (bw *BackgroundWriteCloser) Write(p []byte) (n int, err error)

type CompositeLogger

type CompositeLogger struct {
	// contains filtered or unexported fields
}

func NewCompositeLogger

func NewCompositeLogger(loggers []Logger) *CompositeLogger

func (*CompositeLogger) ClearAllLogFile

func (cl *CompositeLogger) ClearAllLogFile() error

func (*CompositeLogger) ClearCurLogFile

func (cl *CompositeLogger) ClearCurLogFile() error

func (*CompositeLogger) Close

func (cl *CompositeLogger) Close() (err error)

func (*CompositeLogger) ReadLog

func (cl *CompositeLogger) ReadLog(offset int64, length int64) (string, error)

func (*CompositeLogger) ReadTailLog

func (cl *CompositeLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)

func (*CompositeLogger) SetPid

func (cl *CompositeLogger) SetPid(pid int)

func (*CompositeLogger) Write

func (cl *CompositeLogger) Write(p []byte) (n int, err error)

type CustomFormatter

type CustomFormatter logrus.TextFormatter

func (*CustomFormatter) Format

func (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error)

type FileLogger

type FileLogger struct {
	// contains filtered or unexported fields
}

func NewFileLogger

func NewFileLogger(name string, maxSize int64, backups int, logEventEmitter LogEventEmitter, locker sync.Locker) (*FileLogger, error)

func (*FileLogger) ClearAllLogFile

func (l *FileLogger) ClearAllLogFile() error

func (*FileLogger) ClearCurLogFile

func (l *FileLogger) ClearCurLogFile() error

clear the current log file contents

func (*FileLogger) Close

func (l *FileLogger) Close() error

func (*FileLogger) ReadLog

func (l *FileLogger) ReadLog(offset int64, length int64) (string, error)

func (*FileLogger) ReadTailLog

func (l *FileLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)

func (*FileLogger) SetPid

func (l *FileLogger) SetPid(pid int)

func (*FileLogger) Write

func (l *FileLogger) Write(p []byte) (int, error)

Override the function in io.Writer

type LogCaptureLogger

type LogCaptureLogger struct {
	// contains filtered or unexported fields
}

func NewLogCaptureLogger

func NewLogCaptureLogger(underlineLogger Logger,
	captureMaxBytes int,
	stdType string,
	procName string,
	groupName string) *LogCaptureLogger

func (*LogCaptureLogger) ClearAllLogFile

func (l *LogCaptureLogger) ClearAllLogFile() error

func (*LogCaptureLogger) ClearCurLogFile

func (l *LogCaptureLogger) ClearCurLogFile() error

func (*LogCaptureLogger) Close

func (l *LogCaptureLogger) Close() error

func (*LogCaptureLogger) ReadLog

func (l *LogCaptureLogger) ReadLog(offset int64, length int64) (string, error)

func (*LogCaptureLogger) ReadTailLog

func (l *LogCaptureLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)

func (*LogCaptureLogger) SetPid

func (l *LogCaptureLogger) SetPid(pid int)

func (*LogCaptureLogger) Write

func (l *LogCaptureLogger) Write(p []byte) (int, error)

type LogEventEmitter

type LogEventEmitter interface {
	// contains filtered or unexported methods
}

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
}

func NewLogger

func NewLogger(programName string, logFile string, locker sync.Locker, maxBytes int64, backups int, logEventEmitter LogEventEmitter) (Logger, error)

create a logger for a program with parameters

type NullLocker

type NullLocker struct {
}

func NewNullLocker

func NewNullLocker() *NullLocker

func (*NullLocker) Lock

func (l *NullLocker) Lock()

func (*NullLocker) Unlock

func (l *NullLocker) Unlock()

type NullLogEventEmitter

type NullLogEventEmitter struct {
}

func NewNullLogEventEmitter

func NewNullLogEventEmitter() *NullLogEventEmitter

type NullLogger

type NullLogger struct {
	// contains filtered or unexported fields
}

func NewNullLogger

func NewNullLogger(logEventEmitter LogEventEmitter) *NullLogger

func (*NullLogger) ClearAllLogFile

func (l *NullLogger) ClearAllLogFile() error

func (*NullLogger) ClearCurLogFile

func (l *NullLogger) ClearCurLogFile() error

func (*NullLogger) Close

func (l *NullLogger) Close() error

func (*NullLogger) ReadLog

func (l *NullLogger) ReadLog(offset int64, length int64) (string, error)

func (*NullLogger) ReadTailLog

func (l *NullLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)

func (*NullLogger) SetPid

func (l *NullLogger) SetPid(pid int)

func (*NullLogger) Write

func (l *NullLogger) Write(p []byte) (int, error)

type StdLogEventEmitter

type StdLogEventEmitter struct {
	Type string
	// contains filtered or unexported fields
}

func NewStderrLogEventEmitter

func NewStderrLogEventEmitter(process_name string, group_name string, procPidFunc func() int) *StdLogEventEmitter

func NewStdoutLogEventEmitter

func NewStdoutLogEventEmitter(process_name string, group_name string, procPidFunc func() int) *StdLogEventEmitter

type StdLogger

type StdLogger struct {
	NullLogger
	// contains filtered or unexported fields
}

func NewStderrLogger

func NewStderrLogger(logEventEmitter LogEventEmitter) *StdLogger

func NewStdoutLogger

func NewStdoutLogger(logEventEmitter LogEventEmitter) *StdLogger

func (*StdLogger) Write

func (l *StdLogger) Write(p []byte) (int, error)

type SysLogger

type SysLogger struct {
	NullLogger
	// contains filtered or unexported fields
}

func NewRemoteSysLogger

func NewRemoteSysLogger(name string, config string, logEventEmitter LogEventEmitter) *SysLogger

create a network syslog

func NewSysLogger

func NewSysLogger(name string, logEventEmitter LogEventEmitter) *SysLogger

create a local syslog

func (*SysLogger) Close

func (sl *SysLogger) Close() error

func (*SysLogger) Write

func (sl *SysLogger) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL