Documentation
¶
Overview ¶
Package log is a helper for the slog package for configuring and connecting to command line application.
Index ¶
- Constants
- func Format(format, key string, value any) slog.Attr
- func FromContext(ctx context.Context) *slog.Logger
- func New(opts *Options) (*slog.Logger, error)
- func WithFilter(filter func(string) (string, []slog.Attr)) func(*Legacy)
- func WithLevel(level slog.Level) func(*Legacy)
- func WithLogger(ctx context.Context, logger *slog.Logger) context.Context
- type Legacy
- type Options
Constants ¶
View Source
const ( LevelTrace = slog.Level(-8) LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext retrieves the logger from context or fallbacks to slog.Default().
Types ¶
type Legacy ¶
type Legacy struct {
// contains filtered or unexported fields
}
Legacy is a structured logger that implements common logger interfaces.
type Options ¶
Options holds the results of the command line flags.
func NewOptions ¶
func NewOptions(f flagSet) *Options
NewOptions add flags to the command line. Works for cobra and the standard library.
Click to show internal directories.
Click to hide internal directories.