logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(source, message string)

Debug prints out message in the Debug type logger

func Debugf

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

Debugf allows to print out message in the Debug type logger with given format

func Error

func Error(source, message string)

Error prints out message in the Error type logger

func Errorf

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

Errorf allows to print out message in the Error type logger with given format

func Fatal

func Fatal(source, message string)

Fatal prints out message in the Fatal type logger

func Fatalf

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

Fatalf allows to print out message in the Fatal type logger with given format

func GetLogLevel

func GetLogLevel() logrusPackage.Level

GetLogLevel return current log level as a valid logrus level

func GetLogLevelAsString

func GetLogLevelAsString() string

GetLogLevelAsString return current log level as string

func Info

func Info(source, message string)

Info prints out message in the Info type logger

func Infof

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

Infof allows to print out message in the Info type logger with given format

func NewErrorRotatorFileHook

func NewErrorRotatorFileHook(config RotatorFileConfig) logrusPackage.Hook

NewErrorRotatorFileHook creates new instance of rotator file hook (STDERR)

func NewOutputRotatorFileHook

func NewOutputRotatorFileHook(config RotatorFileConfig) logrusPackage.Hook

NewOutputRotatorFileHook creates new instance of rotator file hook (STDOUT)

func Panic

func Panic(source, message string)

Panic prints out message in the Panic type logger

func Panicf

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

Panicf allows to print out message in the Panic type logger with given format

func RegisterErrorRotator

func RegisterErrorRotator(config RotatorFileConfig)

RegisterErrorRotator register `error` log rotator

func RegisterOutputRotator

func RegisterOutputRotator(config RotatorFileConfig)

RegisterOutputRotator register `output` log rotator

func RegisterRotators

func RegisterRotators(outputRotatorConfig RotatorFileConfig, errorRotatorConfig RotatorFileConfig)

RegisterRotators register both `output` and `error` log rotators

func SetLogLevel

func SetLogLevel(level logrusPackage.Level)

SetLogLevel sets log level from a list of valid logrus levels

func SetLogLevelFromString

func SetLogLevelFromString(levelAsString string)

SetLogLevelFromString sets log level from string

func Trace

func Trace(source, message string)

Trace prints out message in the Trace type logger

func Tracef

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

Tracef allows to print out message in the Trace type logger with given format

func Warn

func Warn(source, message string)

Warn prints out message in the Warn type logger

func Warnf

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

Warnf allows to print out message in the Warn type logger with given format

Types

type ErrorRotatorFileHook

type ErrorRotatorFileHook struct {
	// Configuration defines rotator configuration
	Configuration RotatorFileConfig
	// contains filtered or unexported fields
}

ErrorRotatorFileHook represents structure of `error` file hook

func (*ErrorRotatorFileHook) Fire

func (hook *ErrorRotatorFileHook) Fire(entry *logrusPackage.Entry) error

Fire fires writer event

func (*ErrorRotatorFileHook) Levels

func (hook *ErrorRotatorFileHook) Levels() []logrusPackage.Level

Levels returns list of levels which should be processed by the rotator hook

type OutputRotatorFileHook

type OutputRotatorFileHook struct {
	// Configuration defines rotator configuration
	Configuration RotatorFileConfig
	// contains filtered or unexported fields
}

OutputRotatorFileHook represents structure of `output` file hook

func (*OutputRotatorFileHook) Fire

func (hook *OutputRotatorFileHook) Fire(entry *logrusPackage.Entry) error

Fire fires writer event

func (*OutputRotatorFileHook) Levels

func (hook *OutputRotatorFileHook) Levels() []logrusPackage.Level

Levels returns list of levels which should be processed by the rotator hook

type RotatorFileConfig

type RotatorFileConfig struct {
	// FileName defines output file name
	FileName string
	// MaxSize defines maximum log size in megabytes
	MaxSize uint
	// MaxBackups defines maximum number of backups for one file
	MaxBackups uint
	// MaxAge defines maximum age of log in days
	MaxAge uint
	// Level defines log level
	Level logrusPackage.Level
	// Formatter defines formatter used by rotator
	Formatter logrusPackage.Formatter
	// Compress defines whether logs should be compressed
	Compress bool
}

RotatorFileConfig represents configuration for log rotation of a file

Jump to

Keyboard shortcuts

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