Documentation
¶
Index ¶
- func AddBackend(be Backend)
- func Debugf(format string, args ...any)
- func Debugln(args ...any)
- func Errorf(format string, args ...any)
- func Errorln(args ...any)
- func Fatalf(format string, args ...any)
- func Fatalln(args ...any)
- func Infof(format string, args ...any)
- func Infoln(args ...any)
- func SetBackend(be Backend)
- func SetFormattor(ft Formatter)
- func SetLevel(lvl string) error
- func Stop()
- func Sync()
- func Tracef(format string, args ...any)
- func Warnf(format string, args ...any)
- func Warnln(args ...any)
- type Backend
- type Fields
- type Formatter
- type InciseFileBackend
- type Level
- type TextFormatter
- type ZLog
- func (z *ZLog) AddBackend(be Backend)
- func (z *ZLog) Debugf(format string, args ...any)
- func (z *ZLog) Debugln(args ...any)
- func (z *ZLog) Errorf(format string, args ...any)
- func (z *ZLog) Errorln(args ...any)
- func (z *ZLog) Fatalf(format string, args ...any)
- func (z *ZLog) Fatalln(args ...any)
- func (z *ZLog) Infof(format string, args ...any)
- func (z *ZLog) Infoln(args ...any)
- func (z *ZLog) SetBackend(be Backend)
- func (z *ZLog) SetFormattor(ft Formatter)
- func (z *ZLog) SetLevel(level string) error
- func (z *ZLog) Stop()
- func (z *ZLog) Sync()
- func (z *ZLog) Tracef(format string, args ...any)
- func (z *ZLog) Warnf(format string, args ...any)
- func (z *ZLog) Warnln(args ...any)
- func (z *ZLog) WithFields(fields Fields) *ZLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugln ¶
func Debugln(args ...any)
Debugln logs a message at level Debug on the standard logger.
func Errorln ¶
func Errorln(args ...any)
Errorln logs a message at level Error on the standard logger.
func Fatalln ¶
func Fatalln(args ...any)
Fatalln logs a message at level Fatal on the standard logger.
Types ¶
type Formatter ¶
type Formatter interface {
SetLevel(lvl string) error
Format(level Level, msg string) []byte
WithFields(fields Fields)
}
Formatter 格式化前端
type InciseFileBackend ¶
type InciseFileBackend struct {
// contains filtered or unexported fields
}
InciseFileBackend 文件切割后端
func NewInciseFile ¶
func NewInciseFile(filePath, fileLink, prefix string, maxSize int64) (*InciseFileBackend, error)
NewInciseFile create file backend
type Level ¶
type Level uint8
Level 日志等级
func ParseLevel ¶
ParseLevel takes a string level and returns the log level constant.
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
TextFormatter 文本格式化前端
func (*TextFormatter) Format ¶
func (f *TextFormatter) Format(level Level, msg string) []byte
Format 日志格式 2006-01-02 15:04:05 [error] test.go 245 : this is a error
func (*TextFormatter) WithFields ¶
func (f *TextFormatter) WithFields(fields Fields)
WithFields 添加一个map
type ZLog ¶
type ZLog struct {
// contains filtered or unexported fields
}
ZLog is a log
Click to show internal directories.
Click to hide internal directories.