log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(cfg AccessLogger) echo.MiddlewareFunc

LoggerMiddleware is an echo middleware for access logging.

func NewRotateFileHook

func NewRotateFileHook(config RotateFileConfig) logrus.Hook

NewRotateFileHook created a new Logrus file rotation hook.

func SetupLogger

func SetupLogger(cfg AppLogger)

SetupLogger setup application logger.

Types

type AccessLogger

type AccessLogger struct {
	Enabled    bool   `mapstructure:"enabled"`
	Path       string `mapstructure:"path"`
	Format     string `mapstructure:"format"`
	MaxSize    int    `mapstructure:"max-size"`
	MaxBackups int    `mapstructure:"max-backups"`
	MaxAge     int    `mapstructure:"max-age"`
}

AccessLogger represents a struct for echo access logger middleware configurations.

type AppLogger

type AppLogger struct {
	Level      string `mapstructure:"level"`
	Path       string `mapstructure:"path"`
	MaxSize    int    `mapstructure:"max-size"`
	MaxBackups int    `mapstructure:"max-backups"`
	MaxAge     int    `mapstructure:"max-age"`
	StdOut     bool   `mapstructure:"stdout"`
}

AppLogger represents a struct for application logger configurations.

type RotateFileConfig

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

RotateFileConfig represents a configuration struct for the Logrus file rotation hook.

type RotateFileHook

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

RotateFileHook represents a struct for the Logrus file rotation hook.

func (*RotateFileHook) Fire

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

Fire implements the Logrus Hook interface.

func (*RotateFileHook) Levels

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

Levels implements the Logrus Hook interface.

Jump to

Keyboard shortcuts

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