xlogrus

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: MIT Imports: 12 Imported by: 0

README

xlogrus

Functions

Logrus Formatter
  • type CustomFormatter struct {}
  • (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error)
Logrus Rotate Hook
  • type RotateFileConfig struct {}
  • type RotateFileHook struct {}
  • NewRotateFileHook(config *RotateFileConfig) logrus.Hook
  • type RotateLogConfig struct {}
  • type RotateLogHook struct {}
  • NewRotateLogHook(config *RotateLogConfig) logrus.Hook

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRotateFileHook

func NewRotateFileHook(config *RotateFileConfig) logrus.Hook

func NewRotateLogHook

func NewRotateLogHook(config *RotateLogConfig) logrus.Hook

Types

type CustomFormatter

type CustomFormatter struct {
	RuntimeCaller func(*runtime.Frame) (function string, file string)
	ForceColor    bool
	// contains filtered or unexported fields
}

func (*CustomFormatter) Format

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

type RotateFileConfig

type RotateFileConfig struct {
	MaxSize    int  // default to 100 megabytes
	MaxAge     int  // default not to remove old log
	MaxBackups int  // default to retain all old log files
	LocalTime  bool // default to use UTC time
	Compress   bool // default not to perform compression

	Filename  string
	Level     logrus.Level
	Formatter logrus.Formatter
}

RotateFileHook's config

type RotateFileHook

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

Write log into files (split logs to files manually)

func (*RotateFileHook) Fire

func (r *RotateFileHook) Fire(entry *logrus.Entry) error

func (*RotateFileHook) Levels

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

type RotateLogConfig

type RotateLogConfig struct {
	MaxAge       time.Duration
	RotationTime time.Duration
	LocalTime    bool

	Filepath     string
	Filename     string // without ext
	ForceNewFile bool
	Level        logrus.Level
	Formatter    logrus.Formatter
}

RotateLogHook's config

type RotateLogHook

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

Write log into files (split logs to files automatically)

func (*RotateLogHook) Fire

func (r *RotateLogHook) Fire(entry *logrus.Entry) error

func (*RotateLogHook) Levels

func (r *RotateLogHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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