Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupFilterHandler ¶
type GroupFilterHandler struct {
// contains filtered or unexported fields
}
GroupFilterHandler is a slog.Handler that filters log records based on the group associated with it. It only forwards log records to the underlying handler if the group of the log record is in the allow list.
Note this only handles groups created with the WithGroup() method. It does not handle groups created with slog.Group().
func New ¶
func New(handler slog.Handler, allowGroups ...string) *GroupFilterHandler
New creates a new GroupFilterHandler that forwards log records to the provided handler if any groups associated with it is in the allow list. In case there are no allow groups, then all log records are forwarded.
Click to show internal directories.
Click to hide internal directories.