Documentation ¶
Overview ¶
Package logr provides a logger that implements the logr interface
Index ¶
- func Discard() logr.Logger
- func New(cfg *Config) (logr.Logger, error)
- type Config
- type Format
- type LevelHandler
- func (h *LevelHandler) Enabled(_ context.Context, level slog.Level) bool
- func (h *LevelHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *LevelHandler) Handler() slog.Handler
- func (h *LevelHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *LevelHandler) WithGroup(name string) slog.Handler
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
func NewConfigFromFlags ¶
NewConfigFromFlags adds flags to the given flagset, and, after the flagset is parsed by the caller, the flags populate the returned logger config.
type LevelHandler ¶
type LevelHandler struct {
// contains filtered or unexported fields
}
A LevelHandler wraps a Handler with an Enabled method that returns false for levels below a minimum.
func NewLevelHandler ¶
func NewLevelHandler(level slog.Leveler, h slog.Handler) *LevelHandler
NewLevelHandler returns a LevelHandler with the given level. All methods except Enabled delegate to h.
func (*LevelHandler) Enabled ¶
Enabled implements Handler.Enabled by reporting whether level is at least as large as h's level.
func (*LevelHandler) Handler ¶
func (h *LevelHandler) Handler() slog.Handler
Handler returns the Handler wrapped by h.
Click to show internal directories.
Click to hide internal directories.