logs

package
v0.0.0-...-e67ccf8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RotateTimeDaily 默认按天切割
	RotateTimeDaily = "daily"
	// RotateTimeHourly 按小时切割
	RotateTimeHourly = "hourly"
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

func Infof

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

func NewLogger

func NewLogger(options ...LogOption) error

NewLogger 初始化日志记录器

func Panicf

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

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type Fields

type Fields map[string]interface{}

type LogOption

type LogOption func(zl *zapLogger)

LogOption 日志配置项

func WithBackUpCount

func WithBackUpCount(n uint) LogOption

WithBackUpCount 日志数量达到一定量后进行压缩备份

func WithErrorFile

func WithErrorFile(f string) LogOption

WithErrorFile 错误日志名: name_error.logger

func WithFile

func WithFile(f string) LogOption

WithFile 日志文件名: name.logger

func WithFormatText

func WithFormatText(b bool) LogOption

WithFormatText 日志输出格式, json, plaintext

func WithLevel

func WithLevel(l string) LogOption

WithLevel 日志级别: DEBUG, INFO, WARN, ERROR, FATAL

func WithName

func WithName(n string) LogOption

WithName 日志输出时的应用名

func WithRollingPolicy

func WithRollingPolicy(r string) LogOption

WithRollingPolicy 日志切割方式, daily: 每24小时切割; hourly: 每小时切割

func WithRotateDate

func WithRotateDate(d int) LogOption

WithRotateDate 日志转存时间

func WithRotateSize

func WithRotateSize(s int) LogOption

WithRotateSize 日志转存大小

func WithWarnFile

func WithWarnFile(f string) LogOption

WithWarnFile 警告日志文件名: name_warn.logger

func WithWriters

func WithWriters(w string) LogOption

WithWriters 日志输出流, file: 只输出到文件; stdout: 只输出到标准输出流; file,stdout: 同时输出到文件和标准输出流

type Logger

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
	WithFields(fields Fields) Logger
}

func WithFields

func WithFields(fields Fields) Logger

Jump to

Keyboard shortcuts

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