rustout

Crates.iorustout
lib.rsrustout
version0.4.1
sourcesrc
created_at2023-06-03 07:59:27.734228
updated_at2023-06-04 07:26:30.383897
descriptionA simple, lightweight logger with minimal dependencies
homepage
repositoryhttps://github.com/chrisquinnr/rustout
max_upload_size
id881423
size5,728
Chris Quinn (chrisquinnr)

documentation

README

rustout

github crates.io docs.rs

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.
Commit count: 11

cargo fmt