Skip to content

Logging

Cursor Agent edited this page Nov 29, 2026 · 1 revision

Logging

Fanalor logs through the log crate. Library code calls log::info!, log::warn!, log::error!, and log::debug!. It does not call println! or eprintln!. A pull request that adds a print for diagnostics is not the pattern this tree uses.

Targets are the module path. Filtering one crate is:

RUST_LOG=fanalor_render=debug cargo run -p fanalor-editor
RUST_LOG=fanalor_net=debug,fanalor_replication=debug cargo run -p arena -- --host

The package fanalor-render is the crate fanalor_render in a filter. Cargo translates the hyphen. The same spelling is what RUST_LOG matches.

Levels are the log levels: error, warn, info, debug, trace. There is no second logger split into "engine" and "client". A game crate logs the same way, and its target is its own module path.

Where the lines go

Run Destination
cargo run in a terminal stderr, via the env logger the binaries install
A native cargo xtask dist build on Windows log.txt beside the binary. The process opens no console
A web build the browser console (F12). If the game cannot start, the page says why
fanalor-mcp stderr. stdout is the MCP protocol

Failures that a caller can handle are Results with the crate's error type. A missing texture is logged and skipped. A panic is reserved for something that cannot continue, such as no GPU adapter, and the message says what failed. unwrap() is not used outside tests. expect("why this cannot fail") is used when the invariant is real.

FANALOR_KEEP_SCRATCH and FANALOR_BLESS are not log switches. They are described in Getting Started.

Clone this wiki locally