Skip to main content

install_diagnostic_logger

Function install_diagnostic_logger 

Source
pub fn install_diagnostic_logger()
Expand description

Install the stderr diagnostic backend for this process, once.

Call it from any test that wants to read production’s log::info! output. It is safe to call from every test in a binary and from several binaries at once: log::set_logger may only be called once per process, so the work is behind a Once, and a losing call is treated as success — some other backend is already receiving the records, which is the outcome the caller wanted.

The level is chosen in code (Info) and is deliberately not configurable from the environment: the workspace bans environment-dependent behaviour, and a diagnostic you have to know an env var to see is one nobody sees.