Documentation
¶
Index ¶
Constants ¶
View Source
const TimeDisableKey = " "
TimeDisableKey removes time from the output.
Variables ¶
View Source
var LogLevel = new(slog.LevelVar) // The zero LevelVar corresponds to [LevelInfo].
LogLevel holds
Functions ¶
func FromContext ¶ added in v0.15.0
FromContext returns the logger from the provided context. If no logger it returns the default logger.
func LogLevelSet ¶ added in v0.14.0
LogLevelSet updates the application log level.
func LogLevelSwitch ¶ added in v0.14.0
func LogLevelSwitch()
LogLevelSwitch switches the application log level between Debug and Info.
func NewContext ¶ added in v0.15.0
NewContext returns a new context with the provided logger.
Types ¶
type Config ¶
type Config struct {
Debug bool `long:"debug" description:"Show debug info" env:"DEBUG"`
Format string `` //lint:ignore SA5008 accepted as correct
/* 131-byte string literal not displayed */
TimeFormat string `description:"Time format for text output" long:"time_format" env:"TIME_FORMAT" default:"2006-01-02 15:04:05.000"`
Destination string `description:"Log destination (default: '', means STDERR)" long:"dest" env:"DEST"`
}
Config holds package configuration.
Click to show internal directories.
Click to hide internal directories.