Documentation ¶
Overview ¶
Package mock provides a mock slog.Handler implementation and other helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attr ¶
Attr is a mockable representation of slog.Attr.
func AttrsUsingFunc ¶
AttrsUsingFunc returns a new slice of Attr based on the given number and function to get next slog.Attr.
type CallList ¶
type CallList []any
CallList is a list of recorded calls.
func (CallList) WithoutTime ¶
WithoutTime returns a new CallList with all time fields set to zero.
type CallLog ¶
type CallLog struct {
// contains filtered or unexported fields
}
CallLog is a log of method of function calls that can be used to build assertions.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a mockable representation of slog.Handler.
func NewHandler ¶
type HandlerEnabled ¶
HandlerEnabled is a representation of a call to slog.Handler.Enabled that can be used to compare against recorded calls in a CallLog.
type HandlerHandle ¶
HandlerHandle is a representation of a call to slog.Handler.Handle that can be used to compare against recorded calls in a CallLog.
type HandlerWithAttrs ¶
HandlerWithAttrs is a representation of a call to slog.Handler.WithAttrs that can be used to compare against recorded calls in a CallLog.
type HandlerWithGroup ¶
HandlerWithGroup is a representation of a call to slog.Handler.WithGroup that can be used to compare against recorded calls in a CallLog.
type Record ¶
Record is a mockable representation of slog.Record.
func NewRecord ¶
NewRecord returns a new Record based on the given slog.Record.
func (Record) WithoutTime ¶
WithoutTime returns a copy of Record with [Record.Time] set to zero.