logctx

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 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 tags log records with the instance selected on their context.

Dilion serves many instances from one process, so a log line is only useful with the instance it came from. Rather than every call site adding the attribute, each package wraps its logger once with Wrap and logs with the *Context methods; the handler reads ports.LookupInstance from the record's context and adds "instance" when one was selected.

Index

Constants

View Source
const Key = "instance"

Key is the attribute that names the instance.

Variables

This section is empty.

Functions

func Wrap

func Wrap(l *slog.Logger) *slog.Logger

Wrap returns l with its handler wrapped to tag records with the instance selected on their context. A nil l means slog.Default(). Wrapping an already wrapped logger returns it unchanged, so every package can wrap what it is given without stacking handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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