7 unstable releases (3 breaking)
0.4.1 | Jun 4, 2023 |
---|---|
0.4.0 | Jun 3, 2023 |
0.3.0 | Jun 3, 2023 |
0.2.1 | Jun 3, 2023 |
0.1.1 | Jun 3, 2023 |
#265 in #output
Used in rurlr
5KB
rustout
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.
Usage
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.
Customization
You can customize the log level filter and colors used, just modify the code in the main function where the logger is initialised.
Dependencies
log
: A flexible logging framework for Rust.ansi_term
: A crate for coloring and formatting text output in the terminal.
Dependencies
~120–325KB