zlog

package
v0.0.0-...-e0d6b9e Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...Field)

func Debugf

func Debugf(template string, args ...interface{})

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

func Error

func Error(msg string, fields ...Field)

func Errorf

func Errorf(template string, args ...interface{})

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

func Fatal

func Fatal(msg string, fields ...Field)

func Fatalf

func Fatalf(template string, args ...interface{})

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

func Flush

func Flush() error

func Info

func Info(msg string, fields ...Field)

func Infof

func Infof(template string, args ...interface{})

func Infow

func Infow(msg string, keysAndValues ...interface{})

func Init

func Init(config *Config)

初始化全局的日志框架

func Panic

func Panic(msg string, fields ...Field)

func Panicf

func Panicf(template string, args ...interface{})

func Panicw

func Panicw(msg string, keysAndValues ...interface{})

func Warn

func Warn(msg string, fields ...Field)

func Warnf

func Warnf(template string, args ...interface{})

func Warnw

func Warnw(msg string, keysAndValues ...interface{})

Types

type Config

type Config struct {
	FileName      string `json:"fileName" yaml:"fileName"`           // 全路径文件名
	DisableCaller bool   `json:"disableCaller" yaml:"disableCaller"` // 是否添加调用者信息
	MaxSize       int    `json:"maxSize" yaml:"maxSize"`             // 日志输出文件最大长度,超过改值则截断
	MaxAge        int    `json:"maxAge" yaml:"maxAge"`               // 文件最多保存多少天
	MaxBackup     int    `json:"maxBackup" yaml:"maxBackup"`         // 日志文件最多保存多少个备份
	CallerSkip    int    `json:"callerSkip" yaml:"callerSkip"`       // CallerSkip
	Debug         bool   `json:"debug" yaml:"debug"`                 // 是否打印日志到控制台
	Compress      bool   `json:"compress"yaml:"compress"`            // 是否压缩
}

Config 日志配置

func DefaultConfig

func DefaultConfig() Config

type Field

type Field = zap.Field

func FieldAddr

func FieldAddr(value string) Field

func FieldAny

func FieldAny(key string, object interface{}) Field

func FieldCost

func FieldCost(value time.Duration) Field

func FieldErr

func FieldErr(err error) Field

func FieldMethod

func FieldMethod(value string) Field

func FieldMod

func FieldMod(value string) Field

type Logger

type Logger struct {
	// contains filtered or unexported fields
}
var (
	LLogger *Logger
)

func GetLogger

func GetLogger() *Logger

Jump to

Keyboard shortcuts

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