xlogrus

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 12 Imported by: 0

README

xlogrus

Dependencies
  • github.com/sirupsen/logrus
  • gopkg.in/natefinch/lumberjack.v2
  • github.com/lestrrat-go/file-rotatelogs
  • xcolor
Functions
Formatter
  • type CustomFormatter struct {}
  • (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error)
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 {
	TimestampFormat string
	RuntimeCaller   func(*runtime.Frame) (function string, file string)
	DisableColor    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           // log filename (with filepath, filename and extension)
	Level     logrus.Level     // log level
	Formatter logrus.Formatter // text 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 // default to one week
	RotationTime time.Duration // default to one day
	LocalTime    bool          // default to false (UTC)
	ForceNewFile bool          // force to create a new file to record log

	Filepath  string           // log filepath
	Filename  string           // log filename, without extension
	Level     logrus.Level     // log level
	Formatter logrus.Formatter // text 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