Skip to content

trvswgnr/woody

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Woody

A logger for Rust that's *actually* easy to use.

Features

  • Easy to use: Just import the macros and you're good to go. No need to configure anything. No need to create a logger. Just log.
  • Versatile: Log messages at different levels, works across threads, and can be used in libraries.
  • Lightweight: Relies only on lazy_static for thread safety and chrono for timestamps (in addition to the standard library).

Usage

Add this to your Cargo.toml:

[dependencies]
woody = "0.1.2"

Examples

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

Contributing

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 the woody.log file in the current directory after each test run.

cargo test && rm ./woody.log

To publish a new version, update the version number in Cargo.toml and in README.md, and then run:

cargo publish

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A dead simple logger that works globally and across threads.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages