log

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: GPL-3.0 Imports: 7 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

Index

Constants

View Source
const KeyDispatch = "dispatch"

KeyDispatch marks a record as an orchestrator's batch header — the "child (N/M)" line it emits as it hands work to a child. The executor sets it on every dispatch header. The pretty handler uses it to mark a nested hand-off (depth > 1) with a "▸ parent › child" form, so a deep batch header reads as a dispatch by its parent rather than masquerading as an ordinary leaf line; the run's root (depth 1) keeps its "≡ … ≡" chip.

View Source
const KeyModule = "module"

KeyModule is the attribute carrying the executing module's name (set via Logger.With in module.Load, or the per-instance name in the executor). The pretty handler renders it as a colored "[name]" prefix instead of a trailing key=value pair, so interleaved output from different modules stays separable.

View Source
const KeyRoot = "root"

KeyRoot marks a logger as the run's root/orchestrator — a module that fans work out to child modules. The executor sets it (Logger.With(KeyRoot, true)) on any module that has children, so the top-level module's own lines render with the reserved "≡ … ≡" chip. It is a structural signal, not inferred from log order, so it holds even for the very first line an orchestrator emits and for a pure orchestrator that never runs operations of its own. Children inherit the attr but stay plain: root marking is gated on module depth == 1.

View Source
const KeySection = "section"

KeySection marks a log record as a section header. The pretty handler renders it with a leading blank line and bold text; structured handlers keep it as a regular attribute.

Variables

This section is empty.

Functions

func Failuref added in v0.3.0

func Failuref(w io.Writer, format string, args ...any)

Failuref writes a "✖"-prefixed error line to w, colored red when w is a terminal. Used for the top-level command error, which is returned up to main and so never flows through the log handler.

func Successf added in v0.3.0

func Successf(w io.Writer, format string, args ...any)

Successf writes a "✔"-prefixed status line to w, colored green when w is a terminal. Used for closing status output that is not a log record.

func Warningf added in v0.3.0

func Warningf(w io.Writer, format string, args ...any)

Warningf writes a "⚠"-prefixed warning line to w, colored amber when w is a terminal. Used for standalone notices that are not log records.

Types

type PrettyHandler

type PrettyHandler struct {
	// contains filtered or unexported fields
}

PrettyHandler formats log output for human readability.

func NewPrettyHandler

func NewPrettyHandler(w io.Writer, opts *slog.HandlerOptions) *PrettyHandler

NewPrettyHandler creates a human-friendly log handler.

func (*PrettyHandler) Enabled

func (h *PrettyHandler) Enabled(_ context.Context, level slog.Level) bool

func (*PrettyHandler) Handle

func (h *PrettyHandler) Handle(_ context.Context, r slog.Record) error

func (*PrettyHandler) WithAttrs

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

func (*PrettyHandler) WithGroup

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

Jump to

Keyboard shortcuts

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