logctx

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logctx binds log attributes to a context, so that every record logged with that context carries them. A tool call binds its tool name once, and the hub request lines it causes say which call they belong to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attrs

func Attrs(ctx context.Context) []slog.Attr

Attrs returns the attributes bound to ctx, or nil.

func With

func With(ctx context.Context, attrs ...slog.Attr) context.Context

With returns ctx with attrs bound after any already bound.

Types

type Handler

type Handler struct{ slog.Handler }

Handler adds the attributes bound to a record's context, then passes the record to the wrapped handler.

func (Handler) Handle

func (h Handler) Handle(ctx context.Context, r slog.Record) error

Handle adds the bound attributes to r.

func (Handler) WithAttrs

func (h Handler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs keeps the wrapper around the derived handler.

func (Handler) WithGroup

func (h Handler) WithGroup(name string) slog.Handler

WithGroup keeps the wrapper around the derived handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL