log

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFromConfig

func InitFromConfig(c Config) error

InitFromConfig initializes a Logrus instance from config options.

Types

type Config

type Config struct {
	// Level specifies the minimum allowed log level.
	Level string `json:"logging.level" yaml:"logging.level"`
	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename.
	MaxAge int `json:"logging.max-age" yaml:"logging.max-age"`
	// MaxBackups is the maximum number of old log files to retain.
	MaxBackups int `json:"logging.max-backups" yaml:"logging.max-backups"`
	// MaxSize is the maximum size in megabytes of the log file before it gets rotated.
	MaxSize int `json:"logging.max-size" yaml:"logging.max-size"`
	// Formatter represents the log formatter (json | text ).
	Formatter string `json:"logging.formatter" yaml:"logging.formatter"`
	// Path represents the alternative paths for storing the logs.
	Path string `json:"logging.path" yaml:"logging.path"`
	// LogStdout indicates whether log lines are written to standard output in addition to writing them
	// to log files.
	LogStdout bool `json:"logging.log-stdout" yaml:"logging.log-stdout"`
}

Config contains a set of setting that control the behaviour of the logging system.

func (*Config) AddFlags

func (c *Config) AddFlags(flags *pflag.FlagSet)

AddFlags registers persistent logging flags.

func (*Config) InitFromViper

func (c *Config) InitFromViper(v *viper.Viper)

InitFromViper initializes logging configuration from Viper.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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