Crate dev_logger

Source
Expand description

Convenient env_logger for testing purpose.

§Example

// In lib.rs:
#[cfg(test)]
dev_logger::init!();

// In test function:
tracing::info!(name = "message");

// Set RUST_LOG=info and run the test.

Macros§

init
Call init on startup. This is useful for tests.

Functions§

init
Initialize tracing and env_logger for adhoc logging (ex. in a library test) purpose.
traced
Trace the given function using the given filter (in EnvFilter format). Return strings representing the traced logs.

Attribute Macros§

ctor
Marks a function or static variable as a library/executable constructor. This uses OS-specific linker sections to call a specific function at load time.