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

Call init on startup. This is useful for tests.

Functions

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

Attribute Macros

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.