A logger for Rust that's *actually* easy to use.
lazy_static
for thread safety and
chrono
for timestamps (in addition to the standard library).Add this to your Cargo.toml
:
toml
[dependencies]
woody = { git = "https://github.com/trvswgnr/woody.git" }
```rust use woody::*;
fn main() { log!(LogLevel::Info, "An info message."); logdebug!("A debug message."); loginfo!("An info message."); logwarn!("A warning message."); logerror!("An error message."); log_trace!("A trace message."); } ```
Logs are output to the woody.log
file in the current directory.
Environment variables can be set to control the log level and output file:
bash
$ WOODY_LEVEL=error cargo run # Only error messages will be logged
$ WOODY_FILE=woodyrulez.log cargo run # Logs will be written to woodyrulez.log