logk

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Debugw

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

func Error

func Error(args ...interface{})

func Errorf

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

func Errorw

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Fatalw

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

func Info

func Info(args ...interface{})

func Infof

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

func Infow

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

func Panic

func Panic(args ...interface{})

func Panicf

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

func Panicw

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

func Revert added in v0.0.4

func Revert()

func SetLogger

func SetLogger(l Logger)

SetLogger 设置自定义Logger,同时需要注意更新组件的Logger

func SetupLog

func SetupLog(wd string, cf LogConfig) error

SetupLog 初始化默认日志

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warnw

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

Types

type EncodeLevel

type EncodeLevel int8
const (
	Capital EncodeLevel = iota
	CapitalColor
	Lowercase
	LowercaseColor
)

type Level

type Level int8
const (
	DebugLevel Level = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	DPanicLevel
	PanicLevel
	FatalLevel
)

type LogConfig

type LogConfig struct {
	Level       Level       `json:"level" mapstructure:"level"`
	Mode        Mode        `json:"mode" mapstructure:"mode"`
	TimeFormat  string      `json:"time_format" mapstructure:"time_format"`
	EncodeLevel EncodeLevel `json:"encode_level" mapstructure:"encode_level"`
	Name        string      `json:"name" mapstructure:"name"`
	MaxSize     int         `json:"max_size" mapstructure:"max_size"`
	MaxAge      int         `json:"max_age" mapstructure:"max_age"`
	MaxBackups  int         `json:"max_backups" mapstructure:"max_backups"`
	Compress    bool        `json:"compress" mapstructure:"compress"`
}

type Logger

type Logger interface {
	Debug(...interface{})
	Debugf(string, ...interface{})
	Debugw(string, ...interface{})
	Info(...interface{})
	Infof(string, ...interface{})
	Infow(string, ...interface{})
	Warn(...interface{})
	Warnf(string, ...interface{})
	Warnw(string, ...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
	Errorw(string, ...interface{})
	Panic(...interface{})
	Panicf(string, ...interface{})
	Panicw(string, ...interface{})
	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Fatalw(string, ...interface{})
	Skip(int) Logger      // 返回溯源n层的Logger
	PoolGet() interface{} // 从对象池中获取实际的Logger对象
	PoolPut(interface{})  // 把实例对象放回对象池
}

func GetLogger

func GetLogger() Logger

GetLogger 获取日志对象

type Mode

type Mode int8
const (
	Console Mode = iota
	File
	ConsoleAndFile
)

Jump to

Keyboard shortcuts

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