logx

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(format string, args ...any)

func Errorf

func Errorf(format string, args ...any)

func Fatalf

func Fatalf(format string, args ...any)

func Infof

func Infof(format string, args ...any)

func Init

func Init(cfg Config)

Init 初始化日志

func Panicf

func Panicf(format string, args ...any)

func Warnf

func Warnf(format string, args ...any)

Types

type Config

type Config struct {
	// 控制台输出
	EnableConsole     bool   `mapstructure:"enable-console"`
	ConsoleJsonFormat bool   `mapstructure:"console-json-format"`
	ConsoleLevel      string `mapstructure:"console-level"`

	// 文件输出
	EnableFile     bool   `mapstructure:"enable-file"`
	FileJsonFormat bool   `mapstructure:"file-json-format"`
	FileLevel      string `mapstructure:"file-level"`
	FileLocation   string `mapstructure:"file-location"`
	MaxAge         int    `mapstructure:"max-age"`     // 保留文件数量
	MaxSize        int    `mapstructure:"max-size"`    // 单文件最大size
	Compress       bool   `mapstructure:"compress"`    // 是否压缩
	FileExport     string `mapstructure:"file-export"` // 日志备份目录
}

type Field

type Field zap.Field

func Any

func Any(key string, val any) Field

func Bool

func Bool(key string, val bool) Field

func Float32

func Float32(key string, val float32) Field

func Float64

func Float64(key string, val float64) Field

func Int

func Int(key string, val int) Field

func Int16

func Int16(key string, val int16) Field

func Int32

func Int32(key string, val int32) Field

func Int64

func Int64(key string, val int64) Field

func Int8

func Int8(key string, val int8) Field

func String

func String(key, val string) Field

Jump to

Keyboard shortcuts

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