zap

package module
v2.0.0-...-74eeffd Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func NewLogger

func NewLogger(opts ...Option) *Logger

func (*Logger) Close

func (l *Logger) Close() error

Close 关闭日志

func (*Logger) Debug

func (l *Logger) Debug(a ...interface{})

Debug 打印调试日志

func (*Logger) Debugf

func (l *Logger) Debugf(format string, a ...interface{})

Debugf 打印调试模板日志

func (*Logger) Error

func (l *Logger) Error(a ...interface{})

Error 打印错误日志

func (*Logger) Errorf

func (l *Logger) Errorf(format string, a ...interface{})

Errorf 打印错误模板日志

func (*Logger) Fatal

func (l *Logger) Fatal(a ...interface{})

Fatal 打印致命错误日志

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, a ...interface{})

Fatalf 打印致命错误模板日志

func (*Logger) Info

func (l *Logger) Info(a ...interface{})

Info 打印信息日志

func (*Logger) Infof

func (l *Logger) Infof(format string, a ...interface{})

Infof 打印信息模板日志

func (*Logger) Panic

func (l *Logger) Panic(a ...interface{})

Panic 打印Panic日志

func (*Logger) Panicf

func (l *Logger) Panicf(format string, a ...interface{})

Panicf 打印Panic模板日志

func (*Logger) Print

func (l *Logger) Print(level log.Level, a ...interface{})

Print 打印日志,不打印堆栈信息

func (*Logger) Printf

func (l *Logger) Printf(level log.Level, format string, a ...interface{})

Printf 打印模板日志,不打印堆栈信息

func (*Logger) Sync

func (l *Logger) Sync() error

Sync 同步缓存中的日志

func (*Logger) Warn

func (l *Logger) Warn(a ...interface{})

Warn 打印警告日志

func (*Logger) Warnf

func (l *Logger) Warnf(format string, a ...interface{})

Warnf 打印警告模板日志

type Option

type Option func(o *options)

func WithCallerFullPath

func WithCallerFullPath(enable bool) Option

WithCallerFullPath 设置是否启用调用文件全路径

func WithCallerSkip

func WithCallerSkip(skip int) Option

WithCallerSkip 设置调用者跳过的层级深度

func WithClassifiedStorage

func WithClassifiedStorage(enable bool) Option

WithClassifiedStorage 设置启用文件分级存储 启用后,日志将进行分级存储,大一级的日志将存储于小于等于自身的日志级别文件中 例如:InfoLevel级的日志将存储于due.debug.20220910.log、due.info.20220910.log两个日志文件中

func WithFile

func WithFile(file string) Option

WithFile 设置输出的文件路径

func WithFileCutRule

func WithFileCutRule(cutRule log.CutRule) Option

WithFileCutRule 设置文件切割规则

func WithFileMaxAge

func WithFileMaxAge(maxAge time.Duration) Option

WithFileMaxAge 设置文件最大留存时间

func WithFileMaxSize

func WithFileMaxSize(size int64) Option

WithFileMaxSize 设置输出的单个文件尺寸限制

func WithFormat

func WithFormat(format log.Format) Option

WithFormat 设置输出的日志格式

func WithLevel

func WithLevel(level log.Level) Option

WithLevel 设置输出的最低日志级别

func WithStackLevel

func WithStackLevel(level log.Level) Option

WithStackLevel 设置堆栈的最小输出级别

func WithStdout

func WithStdout(enable bool) Option

WithStdout 设置是否输出到终端

func WithTimeFormat

func WithTimeFormat(format string) Option

WithTimeFormat 设置时间格式

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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