Help us shape the future of Go! Take the 2026 Go Developer Survey

logctx

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package logctx carries structured loggers through a context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) *slog.Logger

FromContext falls back to slog.Default when no logger is attached.

func With

func With(ctx context.Context, args ...any) context.Context

With enriches a child context's logger while preserving the parent's logger.

func WithContext

func WithContext(ctx context.Context, logger *slog.Logger) context.Context

WithContext preserves the logger's handler and attributes.

func WithGroup

func WithGroup(ctx context.Context, name string) context.Context

WithGroup groups subsequent attributes without regrouping existing ones.

Types

This section is empty.

Jump to

Keyboard shortcuts

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