log

package
v0.0.0-...-04312dd Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(op *Option) *zap.Logger

func ContextWithLogger

func ContextWithLogger(ctx context.Context, log *zap.Logger) context.Context

func GetContextLogger

func GetContextLogger(ctx context.Context) *zap.Logger

func GetLogger

func GetLogger(ctx context.Context) *zap.Logger

GetLogger 获取定制化的日志

func GetLoggerWithContext

func GetLoggerWithContext(ctx context.Context, l *zap.Logger) *zap.Logger

func Logger

func Logger() *zap.Logger

func NewGormLogger

func NewGormLogger(logger *zap.Logger) *myGormLogger

Types

type Option

type Option struct {
	Path         string `mapstructure:"path" json:"path" yaml:"path" `                               // 日志路径
	MaxAge       int    `mapstructure:"max-age" json:"max-age" yaml:"max-age" `                      // 日志最大保存的天数
	MaxSize      int64  `mapstructure:"max-size" json:"max-size" yaml:"max-size" `                   // 日志切割体积
	Level        string `mapstructure:"level" json:"level" yaml:"level" `                            // 记录的起始等级
	LogInConsole bool   `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console" ` // 是否在控制台输出
	Format       string `mapstructure:"format" json:"format" yaml:"format" `
	LevelEncode  string `mapstructure:"level-encode" json:"level-encode" yaml:"level-encode" `
}

Jump to

Keyboard shortcuts

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