log

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Check       = log.Check
	Core        = log.Core
	DPanic      = log.DPanic
	Debug       = log.Debug
	Error       = log.Error
	Fatal       = log.Fatal
	Info        = log.Info
	Level       = log.Level
	Log         = log.Log
	Named       = log.Named
	Panic       = log.Panic
	Sugar       = log.Sugar
	Sync        = log.Sync
	Warn        = log.Warn
	With        = log.With
	WithOptions = log.WithOptions

	SDPanic      = sugar.DPanic
	DPanicf      = sugar.DPanicf
	DPanicln     = sugar.DPanicln
	DPanicw      = sugar.DPanicw
	SDebug       = sugar.Debug
	Debugf       = sugar.Debugf
	Debugln      = sugar.Debugln
	Debugw       = sugar.Debugw
	Desugar      = sugar.Desugar
	SError       = sugar.Error
	Errorf       = sugar.Errorf
	Errorln      = sugar.Errorln
	Errorw       = sugar.Errorw
	SFatal       = sugar.Fatal
	Fatalf       = sugar.Fatalf
	Fatalln      = sugar.Fatalln
	Fatalw       = sugar.Fatalw
	SInfo        = sugar.Info
	Infof        = sugar.Infof
	Infoln       = sugar.Infoln
	Infow        = sugar.Infow
	SLevel       = sugar.Level
	SNamed       = sugar.Named
	SPanic       = sugar.Panic
	Panicf       = sugar.Panicf
	Panicln      = sugar.Panicln
	Panicw       = sugar.Panicw
	SSync        = sugar.Sync
	SWarn        = sugar.Warn
	Warnf        = sugar.Warnf
	Warnw        = sugar.Warnw
	SWith        = sugar.With
	SWithOptions = sugar.WithOptions
)

Functions

func Compress

func Compress(compress bool) optionFunc

Compress 设置是否压缩处理

func Filename

func Filename(filename string) optionFunc

Filename 设置日志文件名,不需要带文件后缀

func LogLevel

func LogLevel(level int8) optionFunc

LogLevel 设置日志级别

func MaxAge

func MaxAge(maxAge int) optionFunc

MaxAge 设置日志文件保留天数

func MaxBackups

func MaxBackups(maxBackups int) optionFunc

MaxBackups 设置最大保留日志文件数量

func MaxSize

func MaxSize(maxSize int) optionFunc

MaxSize 设置文件大小限制,单位MB

func SetOptions

func SetOptions(opts ...optionFunc)

SetOptions 设置log选项

func Start

func Start() error

Types

type Logger

type Logger = zap.Logger

func WithRequestID

func WithRequestID(id string) *Logger

type Options

type Options struct {
	Filename   string // 日志文件名
	MaxSize    int    // 文件大小限制,单位MB
	MaxBackups int    // 最大保留日志文件数量
	MaxAge     int    // 日志文件保留天数
	Compress   bool   // 是否压缩处理
	Level      int8   // 日志级别
}

Options Log初始化参数

Jump to

Keyboard shortcuts

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