Skip to main content

Module log

Module log 

Source
Expand description

Host-side scheduler diagnostics on stderr, gated by BYTEFLOW_LOG.

§Why this is separate from the print native

Actor-visible logging (CallNative print) writes to stdout and is part of the program’s observable behaviour — samples and demos use it to show envelopes crossing the mailbox. Scheduler diagnostics (spawn / send / park / finish) are an operator concern: they must not pollute stdout when an embedder pipes Flow output, and they must stay off by default so a production run is silent unless asked.

BYTEFLOW_LOG unset / 0 / off / false  → silent
BYTEFLOW_LOG=1 / info / true          → spawn, send, receive, finish
BYTEFLOW_LOG=debug / 2                → also park, deliver queued/handoff

§Lazy init

The level is read from the environment once (first call) and cached in atomics. That avoids re-parsing std::env on every send in a hot worker loop. Tests can override via set_level_for_tests.

Functions§

debug
DEBUG-level line when BYTEFLOW_LOG is debug.
info
INFO-level line when BYTEFLOW_LOG is at least info.
set_level_for_tests
Override the cached level (tests only). 0 off, 1 info, 2 debug.