logx

package
v0.0.0-...-7c465ed Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TraceId = "trace_id"

定义日志中traceid名称

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg string, fields ...LogField)

func Debugf

func Debugf(ctx context.Context, template string, args ...any)

func Error

func Error(ctx context.Context, err error, fields ...LogField)

func Errorf

func Errorf(ctx context.Context, template string, args ...any)

func Fatal

func Fatal(ctx context.Context, msg string, fields ...LogField)

func Fatalf

func Fatalf(ctx context.Context, template string, args ...any)

func Info

func Info(ctx context.Context, msg string, fields ...LogField)

func Infof

func Infof(ctx context.Context, template string, args ...any)

func Init

func Init(cfg LogConfig)

初始化日志

func Panic

func Panic(ctx context.Context, msg error, fields ...LogField)

func Panicf

func Panicf(ctx context.Context, template string, args ...any)

func Warn

func Warn(ctx context.Context, msg string, fields ...LogField)

func Warnf

func Warnf(ctx context.Context, template string, args ...any)

Types

type LogConfig

type LogConfig struct {
	Name       string `mapstructure:"name"`
	Path       string `mapstructure:"path"`
	Level      string `mapstructure:"level"`
	MaxSize    int    `mapstructure:"max-size"`
	MaxBackups int    `mapstructure:"max-backups"`
	MaxAge     int    `mapstructure:"max-age"`
	Compress   bool   `mapstructure:"compress"`
}

日志配置

type LogField

type LogField = zap.Field

隔离引用

func Any

func Any(key string, value interface{}) LogField

func Bool

func Bool(key string, val bool) LogField

func ByteString

func ByteString(key string, val []byte) LogField

func Duration

func Duration(key string, val time.Duration) LogField

func Float32

func Float32(key string, val float32) LogField

func Float64

func Float64(key string, val float64) LogField

func Int

func Int(key string, val int) LogField

func Int32

func Int32(key string, val int32) LogField

func Int64

func Int64(key string, val int64) LogField

func String

func String(key string, val string) LogField

func Time

func Time(key string, val time.Time) LogField

func Uintptr

func Uintptr(key string, val uintptr) LogField

Jump to

Keyboard shortcuts

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