hectorl_logger

Crates.iohectorl_logger
lib.rshectorl_logger
version0.1.1
sourcesrc
created_at2022-08-02 23:11:06.087497
updated_at2022-08-02 23:14:17.676812
descriptionA simple logger with colors
homepage
repository
max_upload_size
id637615
size5,616
Hector Lobato (HectorLobatoSilva)

documentation

README

simple-logger

This is a simple logger to get the next results

[ TRACE ] message
[ DEBUG ] message
[ INFO  ] message
[ WARN  ] message
[ ERROR ] message

Reference

the library responds to the next showing level table

Level of request TRACE DEBUG INFO WARN ERROR OFF
TRACE YES NO NO NO NO NO
DEBUG YES YES NO NO NO NO
INFO YES YES YES NO NO NO
WARN YES YES YES YES NO NO
ERROR YES YES YES YES YES NO

The logger functions uses rest parameters so you can set any number of parameters

Usage

[dependencies]
hectorl_logger = "0.1.0"
/// main.rs
use hectorl_logger::{Levels, Logger};

fn main() {
    let logger = Logger::new(Levels::INFO); // Only INFO, WARN and ERROR log are alowed to print
    // Different ways to set string inside a vector
    logger.info(vec![
        String::from("Some"),
        "data: ".to_string(),
        format!("{}", 45),
    ])
}
// Output with INFO level
// [ INFO ] Some data 45

License

MIT

Commit count: 0

cargo fmt