Crates.io | rustout |
lib.rs | rustout |
version | 0.4.1 |
source | src |
created_at | 2023-06-03 07:59:27.734228 |
updated_at | 2023-06-04 07:26:30.383897 |
description | A simple, lightweight logger with minimal dependencies |
homepage | |
repository | https://github.com/chrisquinnr/rustout |
max_upload_size | |
id | 881423 |
size | 5,728 |
rustout
is a minimal logging crate for Rust that supports printing colors to the terminal output. It has few dependencies and provides an easy-to-use interface for logging messages at different levels.
cargo add rustout
Or, add rustout
as a dependency in your Cargo.toml
file:
rustout = "0.4.1"
Initialise the logger:
use rustout::init_logger;
fn main() {
init_logger()
// Your code here
}
Then start logging messages in your code using the log macros like this:
use log::{error, warn, info, debug, trace};
error!("This is an error message");
warn!("This is a warning message");
info!("This is an info message");
debug!("This is a debug message");
trace!("This is a trace message");
Build and run your project. The log messages will be printed to the terminal with colorized output.
You can customize the log level filter and colors used, just modify the code in the main function where the logger is initialised.
log
: A flexible logging framework for Rust.ansi_term
: A crate for coloring and formatting text output in the terminal.