log

package
v0.194.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package log provides context-aware structured logging helpers for dark-factory. It allows a *slog.Logger to be bound to a context.Context (via NewContext) and retrieved from it (via From), falling back to slog.Default() when no logger is bound.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From

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

From returns the *slog.Logger bound to ctx by NewContext. When no logger is bound (boot path, tests, pre-bind hot-path lines), it returns slog.Default() — never nil. Callers can therefore always call log.From(ctx).Info(...) without a nil check. The fallback emits to whatever handler slog.SetDefault installed (see main.go / pkg/runner/runner.go).

func NewContext

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

NewContext returns a copy of ctx carrying logger. Downstream code retrieves it via From. Re-binding (e.g. after a container is assigned) is done by calling NewContext again with a logger derived via logger.With(...).

Types

This section is empty.

Jump to

Keyboard shortcuts

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