log

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *logrus.Logger

Logger is the global logger.

Functions

func Init

func Init(cfg *LoggerConfig)

Types

type ConfigOption

type ConfigOption func(l *logrus.Logger)

ConfigOption is a function to set logger config.

func SetLevel

func SetLevel(levelStr string) ConfigOption

Put the time pattern in formatter.

type FormatOption

type FormatOption func(f *formatter)

FormatOption is a function to set formatter config.

func SetLogPattern

func SetLogPattern(logPattern string) FormatOption

Put the log pattern in formatter.

func SetTimePattern

func SetTimePattern(timePattern string) FormatOption

Put the time pattern in formatter.

type LoggerConfig

type LoggerConfig struct {
	LogPattern  string `mapstructure:"log_pattern"`
	TimePattern string `mapstructure:"time_pattern"`
	Level       string `mapstructure:"level"`
}

LoggerConfig initializes the global logger config.

Jump to

Keyboard shortcuts

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