dlog

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package dlog is a thin wrapper over log/slog for internal flow tracing. It is distinct from the audit log (forthcoming), which records user-visible, durable events. dlog is for developers debugging the binary, off by default.

Settings come from explicit parameters; lsm reads them from the user's `~/.lsm/config.yaml` (the `log:` block) in PersistentPreRunE and passes them through. No environment variables are consulted.

Index

Constants

This section is empty.

Variables

Discard is the no-op logger returned when level is "off". Useful as a zero-value fallback in callers that haven't yet been wired through PersistentPreRunE (tests, init paths).

Functions

func From

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

From returns the logger stashed on ctx, or Discard if none.

func Into

func Into(ctx context.Context, l *slog.Logger) context.Context

Into returns a context with the given logger attached.

func New

func New(level, dest, format string) (*slog.Logger, io.Closer, error)

New constructs a logger from explicit parameters. Empty strings fall back to defaults; unknown values fall back to defaults AND emit a one-line warning to stderr describing the fallback.

level  = debug | info | warn | error | off   (default: off)
dest   = stderr | stdout | file:/absolute/path (default: stderr)
format = text | json                          (default: text)

When level resolves to "off" the returned logger is Discard.

New does not read or mutate the process environment, so concurrent callers are safe.

Types

This section is empty.

Jump to

Keyboard shortcuts

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