Crates.io | woody |
lib.rs | woody |
version | 0.1.2 |
source | src |
created_at | 2023-04-08 21:19:26.744257 |
updated_at | 2024-04-23 11:58:16.298695 |
description | A logger for Rust that's *actually* easy to use. |
homepage | |
repository | https://github.com/trvswgnr/woody |
max_upload_size | |
id | 833807 |
size | 20,766 |
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
:
[dependencies]
woody = "0.1.2"
use woody::*;
fn main() {
log!(LogLevel::Info, "An info message.");
log_debug!("A debug message.");
log_info!("An info message.");
log_warn!("A warning message.");
log_error!("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:
$ WOODY_LEVEL=error cargo run # Only error messages will be logged
$ WOODY_FILE=woodyrulez.log cargo run # Logs will be written to woodyrulez.log
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[!IMPORTANT]
When running tests, make sure to remove thewoody.log
file in the current directory after each test run.cargo test && rm ./woody.log