log

package
v0.0.0-...-cb6d2b4 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSection

func CheckSection(opt interface{}) bool

func CleanupGlsDefaultKey

func CleanupGlsDefaultKey(key interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Debugln

func Debugln(args ...interface{})

func DisableSection

func DisableSection(opt interface{})

func EnableSection

func EnableSection(opt interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Errorln

func Errorln(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Fatalln

func Fatalln(args ...interface{})

func FlushAll

func FlushAll()

func GetGlsDefaultKey

func GetGlsDefaultKey() interface{}

func Infof

func Infof(format string, args ...interface{})

func Infoln

func Infoln(args ...interface{})

func Recordf

func Recordf(format string, args ...interface{})

func Recordln

func Recordln(args ...interface{})

func SetGlsDefaultKey

func SetGlsDefaultKey(key interface{})

警告: 调用这个接口的地方, 一定要记得使用结束后调用Cleanup, 否则会内存泄漏

func SetLog

func SetLog(l LogI)

func Warningf

func Warningf(format string, args ...interface{})

func Warningln

func Warningln(args ...interface{})

Types

type Buffer

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

func NewBuffer

func NewBuffer(bufSkipSize int) *Buffer

func (*Buffer) FlushTo

func (this *Buffer) FlushTo(w io.Writer) (n int, err error)

type BufferWrap

type BufferWrap struct {
	*Buffer
	// contains filtered or unexported fields
}

func NewBufferWrap

func NewBufferWrap(base *Buffer) *BufferWrap

func (*BufferWrap) Write

func (this *BufferWrap) Write(b []byte) (n int, err error)

func (*BufferWrap) WriteString

func (this *BufferWrap) WriteString(s string) (n int, err error)

type FakeLog

type FakeLog struct{}

func (*FakeLog) Clone

func (this *FakeLog) Clone(opt *LogOption) (LogI, error)

func (*FakeLog) Debugf

func (this *FakeLog) Debugf(format string, args ...interface{})

func (*FakeLog) Debugln

func (this *FakeLog) Debugln(args ...interface{})

func (*FakeLog) Errorf

func (this *FakeLog) Errorf(format string, args ...interface{})

func (*FakeLog) Errorln

func (this *FakeLog) Errorln(args ...interface{})

func (*FakeLog) Fatalf

func (this *FakeLog) Fatalf(format string, args ...interface{})

func (*FakeLog) Fatalln

func (this *FakeLog) Fatalln(args ...interface{})

func (*FakeLog) Flush

func (this *FakeLog) Flush() error

func (*FakeLog) Infof

func (this *FakeLog) Infof(format string, args ...interface{})

func (*FakeLog) Infoln

func (this *FakeLog) Infoln(args ...interface{})

func (*FakeLog) Recordf

func (this *FakeLog) Recordf(format string, args ...interface{})

func (*FakeLog) Recordln

func (this *FakeLog) Recordln(args ...interface{})

func (*FakeLog) Warningf

func (this *FakeLog) Warningf(format string, args ...interface{})

func (*FakeLog) Warningln

func (this *FakeLog) Warningln(args ...interface{})

type FileLog

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

func NewFileLog

func NewFileLog(opt *LogOption) (*FileLog, error)

func (*FileLog) Clone

func (this *FileLog) Clone(opt *LogOption) (LogI, error)

func (*FileLog) Debugf

func (this *FileLog) Debugf(format string, args ...interface{})

func (*FileLog) Debugln

func (this *FileLog) Debugln(args ...interface{})

func (*FileLog) Errorf

func (this *FileLog) Errorf(format string, args ...interface{})

func (*FileLog) Errorln

func (this *FileLog) Errorln(args ...interface{})

func (*FileLog) Fatalf

func (this *FileLog) Fatalf(format string, args ...interface{})

func (*FileLog) Fatalln

func (this *FileLog) Fatalln(args ...interface{})

func (*FileLog) Flush

func (this *FileLog) Flush() error

func (*FileLog) Infof

func (this *FileLog) Infof(format string, args ...interface{})

func (*FileLog) Infoln

func (this *FileLog) Infoln(args ...interface{})

func (*FileLog) Recordf

func (this *FileLog) Recordf(format string, args ...interface{})

func (*FileLog) Recordln

func (this *FileLog) Recordln(args ...interface{})

func (*FileLog) Warningf

func (this *FileLog) Warningf(format string, args ...interface{})

func (*FileLog) Warningln

func (this *FileLog) Warningln(args ...interface{})

type Level

type Level int

---------------------------------------------------

func (Level) Header

func (lv Level) Header() string

func (Level) ToString

func (lv Level) ToString() string

type LogI

type LogI interface {
	Clone(opt *LogOption) (LogI, error)

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Recordf(format string, args ...interface{})

	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Warningln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
	Recordln(args ...interface{})

	Flush() error
}

---------------------------------------------------

func BindOption

func BindOption(key interface{}, opt *LogOption) (LogI, error)

func GetLog

func GetLog(keys ...interface{}) LogI

func MakeLogger

func MakeLogger(opt *LogOption) (LogI, error)

type LogOption

type LogOption struct {
	// log struct type
	LogCategory string

	// toggle of logger
	Ignore bool

	// output file name
	OutputFile string

	// log info format: "$Level $datetime-ms $gid $file:$line] "
	HeaderFormat string

	// rotate category: size / time / ""
	RotateCategory string

	// rotate parameter: bytes of one file / seconds
	RotateValue int64

	// rotate suffix format of filename: .$pid.$day-$hour-$minute-$second.log
	RotateSuffixFormat string

	// extends fields
	Extends map[string]string
	// contains filtered or unexported fields
}

func DefaultLogOption

func DefaultLogOption() *LogOption

func (*LogOption) Clone

func (this *LogOption) Clone() *LogOption

func (*LogOption) GetSuffix

func (this *LogOption) GetSuffix() string

func (*LogOption) WriteHeader

func (this *LogOption) WriteHeader(level Level, depth int, buf io.Writer) int

type Manager

type Manager struct {
	// contains filtered or unexported fields
}
var LogMgr *Manager = NewManager((*LogI)(nil))

func NewManager

func NewManager(handlerType interface{}) *Manager

func (*Manager) Get

func (this *Manager) Get(name string) interface{}

func (*Manager) Register

func (this *Manager) Register(name string, obj interface{})

type RingBuf

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

func NewRingBuf

func NewRingBuf(nBufs int, bufSkipSize int) *RingBuf

func (*RingBuf) FlushTo

func (this *RingBuf) FlushTo(w io.Writer) (err error)

func (*RingBuf) GetWriter

func (this *RingBuf) GetWriter() *BufferWrap

func (*RingBuf) LockFlushTo

func (this *RingBuf) LockFlushTo(w io.Writer) (err error)

func (*RingBuf) NextReader

func (this *RingBuf) NextReader() *Buffer

func (*RingBuf) Put

func (this *RingBuf) Put(bufw *BufferWrap)

type StdLog

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

func (*StdLog) Clone

func (this *StdLog) Clone(opt *LogOption) (LogI, error)

func (*StdLog) Debugf

func (this *StdLog) Debugf(format string, args ...interface{})

func (*StdLog) Debugln

func (this *StdLog) Debugln(args ...interface{})

func (*StdLog) Errorf

func (this *StdLog) Errorf(format string, args ...interface{})

func (*StdLog) Errorln

func (this *StdLog) Errorln(args ...interface{})

func (*StdLog) Fatalf

func (this *StdLog) Fatalf(format string, args ...interface{})

func (*StdLog) Fatalln

func (this *StdLog) Fatalln(args ...interface{})

func (*StdLog) Flush

func (this *StdLog) Flush() error

func (*StdLog) Infof

func (this *StdLog) Infof(format string, args ...interface{})

func (*StdLog) Infoln

func (this *StdLog) Infoln(args ...interface{})

func (*StdLog) Recordf

func (this *StdLog) Recordf(format string, args ...interface{})

func (*StdLog) Recordln

func (this *StdLog) Recordln(args ...interface{})

func (*StdLog) Warningf

func (this *StdLog) Warningf(format string, args ...interface{})

func (*StdLog) Warningln

func (this *StdLog) Warningln(args ...interface{})

Jump to

Keyboard shortcuts

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