Skip to content

chrisquinnr/rustout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple, lightweight logger with minimal dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages