Documentation ¶
Overview ¶
Package logger provides logging configuration and helpers to pass a logger instance through the context.
Index ¶
Constants ¶
View Source
const ErrKey = "err"
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the *slog.Logs previously stored in ctx by NewContext. slog.Default() is returned otherwise.
func FromContextMaybe ¶
FromContextMaybe returns the *slog.Logs previously stored in ctx by NewContext or nil.
func FromRootCommand ¶
FromRootCommand returns a logger from the root cobra.Command context or nil.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config specifies user configurable flag values to create a NewLogger
func (*Config) GetLogLevel ¶
GetLogLevel returns a slog.Level configured by the user
A non-zero length DEBUG env var takes precedence over config fields.
Click to show internal directories.
Click to hide internal directories.