logger

package
v0.0.0-...-f14b9eb Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zap.Logger

Functions

func Close

func Close(f func())

func Debug

func Debug(ctx context.Context, v ...interface{})

func Debugf

func Debugf(ctx context.Context, format string, v ...interface{})

func Error

func Error(ctx context.Context, v ...interface{})

func Errorf

func Errorf(ctx context.Context, format string, v ...interface{})

func Info

func Info(ctx context.Context, v ...interface{})

func Infof

func Infof(ctx context.Context, format string, v ...interface{})

func InitLog

func InitLog(c Config)

func InitLogger

func InitLogger()

func Panic

func Panic(ctx context.Context, v ...interface{})

func Panicf

func Panicf(ctx context.Context, format string, v ...interface{})

func Warn

func Warn(ctx context.Context, v ...interface{})

func Warnf

func Warnf(ctx context.Context, format string, v ...interface{})

Types

type Config

type Config struct {
	Level       string `json:",default=Info,options=Debug|Info|Warn|Error|Panic|fatal"` //日志级别,默认为info
	FilePath    string `json:",default=/log,optional"`                                  //日志文件路径
	LogType     string `json:",default=zap,options=logrus|zap,optional"`                //日志类型,默认zap,目前支持zap和logrus
	ServiceName string `json:",optional"`                                               //所属服务
	MaxSize     int    `json:",default=10,optional"`                                    //日志文件最大数量
	MaxAge      int    `json:",default=30,optional"`                                    //最大保留天数
	BackupNum   int    `json:",default=100,optional"`                                   //最大保留日志文件数量
	Compress    bool   `json:",default=false,optional"`                                 //是否压缩
}

type DefaultFieldHook

type DefaultFieldHook struct {
	// contains filtered or unexported fields
}

func (*DefaultFieldHook) Fire

func (hook *DefaultFieldHook) Fire(entry *logrus.Entry) error

func (*DefaultFieldHook) Levels

func (hook *DefaultFieldHook) Levels() []logrus.Level

type ILog

type ILog interface {
	Info(ctx context.Context, v ...interface{})
	Infof(ctx context.Context, format string, v ...interface{})
	Error(ctx context.Context, v ...interface{})
	Errorf(ctx context.Context, format string, v ...interface{})
	Panic(ctx context.Context, v ...interface{})
	Panicf(ctx context.Context, format string, v ...interface{})
	Warn(ctx context.Context, v ...interface{})
	Warnf(ctx context.Context, format string, v ...interface{})
	Debug(ctx context.Context, v ...interface{})
	Debugf(ctx context.Context, format string, v ...interface{})

	WithField(field, value string)
	// contains filtered or unexported methods
}

func GetLogger

func GetLogger() ILog

type KeyPair

type KeyPair struct {
	Key string      `json:"key"`
	Val interface{} `json:"val"`
}

Jump to

Keyboard shortcuts

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