logger

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger = logrus.New()
)

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 Info

func Info(args ...interface{})

func Infof

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

func InitLog

func InitLog(logFileName, LogLevel, LogPath string, formatter *Formatter, loggerObj *logrus.Logger)

func InitOutToFile

func InitOutToFile(logPath, logFileName string) error

func NewRotateFileHook

func NewRotateFileHook(config RotateFileConfig) (logrus.Hook, error)

func Panic

func Panic(args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type Formatter

type Formatter struct {
	// Timestamp format
	TimestampFormat string
	// Available standard keys: time, msg, lvl
	// Also can include custom fields but limited to strings.
	// All of fields need to be wrapped inside %% i.e %time% %msg%
	LogFormat string

	// Disables the truncation of the level text to 4 characters.
	DisableLevelTruncation bool
}

Formatter implements logrus.Formatter interface.

func (*Formatter) Format

func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)

Format building log message.

type RotateFileConfig

type RotateFileConfig struct {
	Filename   string
	MaxSize    int
	MaxBackups int
	MaxAge     int
	Level      logrus.Level
	LocalTime  bool
	Formatter  logrus.Formatter
}

type RotateFileHook

type RotateFileHook struct {
	Config RotateFileConfig
	// contains filtered or unexported fields
}

func (*RotateFileHook) Fire

func (hook *RotateFileHook) Fire(entry *logrus.Entry) (err error)

func (*RotateFileHook) Levels

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

Jump to

Keyboard shortcuts

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