loggers

package
v0.0.0-...-b08fcc5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func NewLogger

func NewLogger(options ...Option) *Logger

func NewMysqlLogger

func NewMysqlLogger(c *MysqlLoggerConfig, level gormLogger.LogLevel) *Logger

func NewMysqlSlowLogger

func NewMysqlSlowLogger(c *MysqlSlowLoggerConfig) *Logger

func NewRedisLogger

func NewRedisLogger(c *RedisLoggerConfig, level logrus.Level) *Logger

func NewRedisSlowLogger

func NewRedisSlowLogger(c *RedisSlowLoggerConfig) *Logger

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal 记完日志后会调用os.Exit(1)

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

func (*Logger) For

func (l *Logger) For(ctx context.Context) *logrus.Entry

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) LogFileNameFormat

func (l *Logger) LogFileNameFormat(level logrus.Level) string

LogFileNameFormat 日志名格式化

func (*Logger) LogLinkNameFormat

func (l *Logger) LogLinkNameFormat(level logrus.Level) string

LogLinkNameFormat 日志名格式化

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic 记完日志后会调用 panic()

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

func (*Logger) Trace

func (l *Logger) Trace(args ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(format string, args ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

func (*Logger) Warning

func (l *Logger) Warning(args ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(format string, args ...interface{})

func (*Logger) WithFields

func (l *Logger) WithFields(args logrus.Fields) *logrus.Entry

type MysqlLoggerConfig

type MysqlLoggerConfig struct {
	LogPath        string `json:"log_path"`         // 日志位置
	MaxAge         int64  `json:"max_age"`          // 存储时间
	FileNameFormat string `json:"file_name_format"` // 文件名    注意格式化名宇切割窗口需要一直              %Y%m%d%H
	RotationTime   int64  `json:"rotation_time"`    // 切割窗口   默认按小时切割,自定义需要跟日志名格式化一直  time.Hour
}

type MysqlSlowLoggerConfig

type MysqlSlowLoggerConfig struct {
	LogPath        string `json:"log_path"`         // 日志位置
	MaxAge         int64  `json:"max_age"`          // 存储时间
	FileNameFormat string `json:"file_name_format"` // 文件名    注意格式化名宇切割窗口需要一直              %Y%m%d%H
	RotationTime   int64  `json:"rotation_time"`    // 切割窗口   默认按小时切割,自定义需要跟日志名格式化一直  time.Hour
}

type Option

type Option func(*Logger)

func WithDisplayTerminal

func WithDisplayTerminal(displayTerminal bool) Option

func WithFileName

func WithFileName(fileName string) Option

func WithFileNameFormat

func WithFileNameFormat(format string) Option

func WithFilePath

func WithFilePath(filePath string) Option

func WithLevel

func WithLevel(level logrus.Level) Option

func WithMaxAge

func WithMaxAge(maxAge time.Duration) Option

func WithRotationTime

func WithRotationTime(rotationTime time.Duration) Option

func WithSetReportCaller

func WithSetReportCaller(reportCaller bool) Option

type RedisLoggerConfig

type RedisLoggerConfig struct {
	LogPath        string `json:"log_path"`         // 日志位置
	MaxAge         int64  `json:"max_age"`          // 存储时间
	FileNameFormat string `json:"file_name_format"` // 文件名    注意格式化名宇切割窗口需要一直              %Y%m%d%H
	RotationTime   int64  `json:"rotation_time"`    // 切割窗口   默认按小时切割,自定义需要跟日志名格式化一直  time.Hour
}

type RedisSlowLoggerConfig

type RedisSlowLoggerConfig struct {
	LogPath        string `json:"log_path"`         // 日志位置
	MaxAge         int64  `json:"max_age"`          // 存储时间
	FileNameFormat string `json:"file_name_format"` // 文件名    注意格式化名宇切割窗口需要一直              %Y%m%d%H
	RotationTime   int64  `json:"rotation_time"`    // 切割窗口   默认按小时切割,自定义需要跟日志名格式化一直  time.Hour
}

Jump to

Keyboard shortcuts

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