logs

package
v0.0.0-...-c3ec36b Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultColorTextFormatter = logrus.TextFormatter{
	DisableColors:             false,
	ForceColors:               true,
	FullTimestamp:             true,
	EnvironmentOverrideColors: true,
	TimestampFormat:           "2006-01-02 15:04:05.999",
}
View Source
var DefaultJsonFormatter = logrus.JSONFormatter{
	TimestampFormat: "2006-01-02 15:04:05.999",
	FieldMap: logrus.FieldMap{
		logrus.FieldKeyTime:  "@timestamp",
		logrus.FieldKeyLevel: "@level",
		logrus.FieldKeyMsg:   "@message",
		logrus.FieldKeyFunc:  "@caller",
	},
}
View Source
var DefaultTextFormatter = logrus.TextFormatter{
	DisableColors:   true,
	TimestampFormat: "2006-01-02 15:04:05.999",
}

Functions

func Debugf

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

func Errorf

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

func Fatalf

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

func Infof

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

func Panicf

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

func Printf

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

func Tracef

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

func Warnf

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

func Warningf

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

Types

type ILogger

type ILogger interface {
	Trace(args ...interface{})
	Tracef(format string, args ...interface{})

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

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

	Print(args ...interface{})
	Printf(format string, args ...interface{})

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

	Warning(args ...interface{})
	Warningf(format string, args ...interface{})

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

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

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

type LineHook

type LineHook struct {
	Field string
	// contains filtered or unexported fields
}

line number hook for log the call context,

func (LineHook) Fire

func (hook LineHook) Fire(entry *log.Entry) error

Fire implement fire

func (LineHook) Levels

func (hook LineHook) Levels() []log.Level

Levels implement levels

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

func GetDefaultLogger

func GetDefaultLogger() *Logger

获取默认日志中

func New

func New() *Logger

新建一个日志文件

func (*Logger) EnableSource

func (l *Logger) EnableSource()

func (*Logger) HookToFile

func (l *Logger) HookToFile(logPath string, maxDay uint, format logrus.Formatter)

附加输出到文件

func (*Logger) HookToSysLog

func (l *Logger) HookToSysLog(network, raddr string, priority slog.Priority, tag string) error

日志输入到syslog

func (*Logger) RemoveHook

func (l *Logger) RemoveHook(h logrus.Hook)

func (*Logger) ToFile

func (l *Logger) ToFile(logPath string, maxDay uint, format logrus.Formatter)

日志输入到文件

func (*Logger) ToSysLog

func (l *Logger) ToSysLog(network, raddr string, priority slog.Priority, tag string) error

Jump to

Keyboard shortcuts

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