proclog

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 9 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

NewBackendSysLogWriter creates background syslog writer

func (*BackendSysLogWriter) Close

func (bs *BackendSysLogWriter) Close() error

Close background write channel

func (*BackendSysLogWriter) Write

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

Write data to the backend syslog writer

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) ReadLog

func (that *ChanLogger) ReadLog(_ int64, _ int64) (string, error)

func (*ChanLogger) ReadTailLog

func (that *ChanLogger) ReadTailLog(_ int64, _ int64) (string, int64, bool, error)

func (*ChanLogger) SetPid

func (that *ChanLogger) SetPid(_ int)

func (*ChanLogger) Write

func (that *ChanLogger) Write(p []byte) (int, error)

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

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

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)

func (*CompositeLogger) Write

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

type FileLogger

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

FileLogger 写入stdout/stderr到文件

func NewFileLogger

func NewFileLogger(fileName string, maxSize int64, backups int, locker sync.Locker) *FileLogger

func (*FileLogger) ClearAllLogFile

func (that *FileLogger) ClearAllLogFile() error

ClearAllLogFile 清除所有日志文件,包括保留的备份

func (*FileLogger) ClearCurLogFile

func (that *FileLogger) ClearCurLogFile() error

ClearCurLogFile 清除当前日志文件

func (*FileLogger) Close

func (that *FileLogger) Close() error

Close 关闭文件

func (*FileLogger) ReadLog

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

ReadLog 读取日志

func (*FileLogger) ReadTailLog

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

ReadTailLog 读取尾部日志

func (*FileLogger) SetPid

func (that *FileLogger) SetPid(pid int)

func (*FileLogger) Write

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

日志文件写入

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 日志的接口

func NewLogger

func NewLogger(programName string, logFile string, locker sync.Locker, maxBytes int64, backups int, props map[string]string) Logger

NewLogger 新建日志对象

type NullLocker

type NullLocker struct{}

NullLocker 假锁

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 (that *NullLogger) ReadTailLog(offset int64, length int64) (string, int64, bool, error)

func (*NullLogger) SetPid

func (that *NullLogger) SetPid(pid int)

func (*NullLogger) Write

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

type StdLogger

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

func NewStderrLogger

func NewStderrLogger() *StdLogger

func NewStdoutLogger

func NewStdoutLogger() *StdLogger

func (*StdLogger) Write

func (that *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, props map[string]string) *SysLogger

NewRemoteSysLogger 获取远程系统日志的对象

func NewSysLogger

func NewSysLogger(name string, props map[string]string) *SysLogger

NewSysLogger 获取系统syslog的对象

func (*SysLogger) Close

func (that *SysLogger) Close() error

func (*SysLogger) Write

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

Jump to

Keyboard shortcuts

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