Documentation
¶
Index ¶
- func BuildAttributes(ctx context.Context, r *http.Request, ...) []interface{}
- func DefaultExtractor(ctx context.Context, r *http.Request) map[string]interface{}
- func GetLogger(ctx context.Context) *slog.Logger
- func New(logger slog.Logger, extractFunction ExtractFunction) mux.MiddlewareFunc
- type ExtractFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAttributes ¶
func DefaultExtractor ¶
DefaultExtractor extracts operation request fields from the context. It returns the filtered map containing only the specified keys.
func New ¶
func New(logger slog.Logger, extractFunction ExtractFunction) mux.MiddlewareFunc
New creates a context logging middleware. Parameters
logger: A slog.Logger instance used for logging. Any static attributes added to this logger before passing it in will be preserved extractFunction: ExtractFunction extracts information from the ctx and/or the request and put it in the logger
Types ¶
Click to show internal directories.
Click to hide internal directories.