log

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Logger 日志实例
	Logger *zap.Logger
)

Functions

func Debug

func Debug(ctx context.Context, msg string)

Debug Debug日志

func Error

func Error(ctx context.Context, msg string)

Error 错误日志

func Info

func Info(ctx context.Context, msg string)

Info 信息日志

func InitLog

func InitLog(config *Config)

func Warn

func Warn(ctx context.Context, msg string)

Warn 警告日志

Types

type Config

type Config struct {
	Filename             string
	RollingLogMaxSize    int
	RollingLogMaxBackups int
	RollingLogMaxAge     int
	Compress             bool
	LastLog              func(ctx context.Context) []zap.Field
	Level                zapcore.Level
	StdOut               bool
}

Config log 配置

func NewConfig

func NewConfig(options ...Options) *Config

NewConfig 实例化日志配置

type Options

type Options func(config *Config)

Options 配置选项

func WithOutput

func WithOutput(filename string) Options

WithOutput 输出文件

func WithStdout

func WithStdout() Options

WithStdout 标准输出

Jump to

Keyboard shortcuts

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