writer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoggerLevel

func GetLoggerLevel(lvl string) logrus.Level

func GetLowLogLevel

func GetLowLogLevel(writers []Writer) logrus.Level

GetLowLogLevel 获取writer中最低日志级别

Types

type ConsoleConfig

type ConsoleConfig struct {
	LogLevel string // 日志级别,可选,默认debug
}

ConsoleConfig 用户自定义console配置

type FileConfig

type FileConfig struct {
	Filename    string // 日志文件, 默认"./log/rlog.log",可选
	MaxFileSize int    // 日志文件单个文件最大大小,单位为MB,默认100,可选
	MaxBackups  int    // 日志文件最大历史保留份数,默认5,可选
	MaxAge      int    // 日志文件最长存活时间,单位为天, 默认30,可选
	Compress    bool   // 历史日志压缩保存,默认false,可选
	LogLevel    string // 日志级别,默认debug,可选
}

FileConfig 用户自定义File配置

type REntry

type REntry struct {
	Loglevel logrus.Level // 日志级别
	Message  []byte       // 日志内容
}

REntry 日志内容

type Writer

type Writer interface {
	// GetLogLevel 获取日志级别
	GetLogLevel() string
	// Check 日志检查,过滤掉不必要的日志输入
	Check(*REntry) bool
	// Write 日志输出内容
	Write([]byte) error
}

func NewConsoleWriter

func NewConsoleWriter(opt *ConsoleConfig) Writer

func NewFileWriter

func NewFileWriter(opt *FileConfig) Writer

Jump to

Keyboard shortcuts

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