Documentation
¶
Index ¶
- type Capture
- type ErrorHandler
- func (h *ErrorHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *ErrorHandler) Err() error
- func (h *ErrorHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *ErrorHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *ErrorHandler) WithGroup(name string) slog.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capture ¶
type Capture[T any] struct { // contains filtered or unexported fields }
Capture is an io.Writer that unmarshals the written data into entries of type T, to be later retrieved with Entries(). Written buffers must be valid JSON by themselves, and if the unmarshaling errors, Write will return an error.
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
ErrorHandler is used for capturing errors from a slog.Handler as slog.Logger swallows them.
func NewErrorHandler ¶
func NewErrorHandler(inner slog.Handler) *ErrorHandler
NewErrorHandler returns a new ErrorHandler.
func NewWithErrorHandler ¶
func NewWithErrorHandler(h slog.Handler) (*slog.Logger, *ErrorHandler)
NewWithErrorHandler wraps the passed slog.Handler into an ErrorHandler, creates a new slog.Logger, then returns the Logger and the ErrorHandler.
Click to show internal directories.
Click to hide internal directories.