Proposal: standard logging (Log.*) — levels, structured fields, console/file/overlay sinks #15
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
A standard logging library with levels, structured fields, and pluggable
outputs (console, file, in-game overlay) — the default way to answer "what is my
game doing?" and "why did that break?"
Why it matters for game devs
Give them something better than scattered
printcalls.playtests.
Proposed API (illustrative)
trace/debug/info/warn/error.Considerations
from the Time library and are excluded from replays.
debuglogs.Scope / acceptance
Lognamespace with levels + structured fields.add_sink/set_level.Related: Time, Filesystem & IO, Jobs & async, error handling.
Done in commit
031b138.Added the
Log.*namespace — levelled, structured logging to stderr:Log.trace/debug/info/warn/error(msg, [key, value]...)— printed as[LEVEL] msg key=value ....Log.set_level(n)— runtime threshold (0=all default … 4=error, 5 silences all);Log.level()reads it back.Writes to stderr and returns, never touching the simulation, so logging has no effect on determinism/replays.
Acceptance:
Lognamespace with levels + structured fieldsadd_sink/rotating-file/overlay — see belowset_level, compile-time tag)Tests:
examples/library/logging.ludic(wired intox test); stderr gating verified by hand (warn/error emit, lower levels suppressed). Docs: newdocs/language/log/section.Scoped for v1: the pluggable rotating-file sink and in-engine overlay sink (
add_sink) are deliberately deferred — the file sink wants the Filesystem library (#10) and the overlay wants a live screen handle. Filing those as follow-ups; the console sink + levels + structured fields cover the common case now.