Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAttrs ¶
ExtractAttrs is a slogctx Extractor that must be used with a slogctx.Handler (via slogctx.HandlerOptions) as Prependers or Appenders. It will cause the Handler to add the Attributes added by slogctx.Add() to all log lines using that same context.
func Init ¶
Init initializes a context that allows propagating attributes from child context back to parents. Essentially, it lets you collect slog attributes that are discovered later in the stack (such as authentication and user ID's, derived values, attributes only discovered halfway-through the final request handler after several db queries, etc), and be able to have them be included in the log lines of other middlewares (such as a middleware that logs all requests that come in). For a ready-to-use http middleware that implements this feature, see package github.com/veqryn/slog-context/http
Types ¶
This section is empty.