Skip to content

Logs: debug when developing, info in release, warnings in the file - #1900

Open
vmillet-dev wants to merge 1 commit into
architecture-wikifrom
logs-levels
Open

vmillet-dev wants to merge 1 commit into
architecture-wikifrom
logs-levels

Conversation

@vmillet-dev

Copy link
Copy Markdown
Owner

Closes #1842

Stacked on #1898 (the wiki): its base is architecture-wiki so that this diff is this ticket alone. Merge #1898 first; this pull request then targets dev/1.3.3.

Levels, by build (crates/app/src/logging.rs)

Build Terminal File
debug our crates from debug warn and error
release our crates from info warn and error
e2e flavour error alone, as today our crates from debug

Our crates are the workspace's (the binary's own read from CARGO_CRATE_NAME, which is devnotes, not app); every other crate stays at warn, and the two echoes (cargo_packager_updater, eframe::native::run) stay off. The file writer is a FileLogWriter we build with its own max_level, handed to flexi_logger as its writer, the terminal a duplicate: no new crate, and #1845 will wrap that writer.

The e2e flavour's console stays quiet. Its terminal is a file the driver keeps beside a failed journey, and journey 1 checks it says nothing at first launch: it keeps to errors, so nothing new reaches a run's console. Its log holds every level from debug, and is kept beside a failed journey only, as today. Journey 1's first step now also checks that the log holds debug lines (app.disk().expect_debug_in_log).

DEVNOTES_LOG, in flexi_logger's syntax, replaces the levels for one run in any build; unreadable (or not UTF-8), it is ignored and one warning says so, without echoing the value. The first debug line of a run says the levels in force.

One line format for both outputs: 2026-12-04 18:45:04.185 DEBUG [main] devnotes::logging: … — local time to the millisecond, level, thread, target, message.

Docs — decision D35 Logs (D34 was already the title bar); a new wiki page docs/architecture/logs.md (« The three outputs », « What a line may say », « Changing the levels for one run »); engine.md, testing.md and CONTRIBUTING.md (logs while developing, DEVNOTES_LOG, what a failed journey leaves).

Owner's decision applied — the variable keeps the DEVNOTES_ prefix (asked in this session, for #1896 too).

Checks run (Linux)

  • cargo test -p app --bin devnotes logging: 12 pass. The terminal test is now five tests run apart: a debug build (debug shown, file warn+), a release (info shown, debug not, file warn+), the e2e flavour (terminal errors alone, file from debug), the line format, DEVNOTES_LOG=engine=trace (a trace line of engine alone), and an unreadable value (default levels, one warning). A dependency's info reaches neither output in each.
  • Journey 01_first_day under Xvfb: green, console showing the steps alone.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo fmt --all --check, node --test "scripts/*.test.mjs".

Generated by Claude Code

A debug build's terminal shows our crates from debug, a release's from
info; the file keeps warnings and errors alone. Every other crate stays
at warn, the two echoes off. The e2e flavour files from debug, kept
beside a failed journey, and keeps its terminal to errors, so a run's
console stays as quiet as it was. DEVNOTES_LOG replaces the levels for
one run; an unreadable one is ignored with a warning. One line format
for both outputs: local time to the millisecond, level, thread, target.

Decision D35 (D34 was taken); the wiki gets its logs page.

Closes #1842

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants