rovella_logger

Crates.iorovella_logger
lib.rsrovella_logger
version0.1.4
sourcesrc
created_at2022-07-16 17:05:38.594289
updated_at2022-08-05 03:59:27.650364
descriptionA simple logger that is used by the rovella game library (the rest of the library is still in developement)
homepage
repository
max_upload_size
id626817
size4,364
(Spleeshmicannon)

documentation

README

The Rovella Logger

This is a simple low overhead logger than uses eprintln and println with format to log text and other data.

Examples

The fatal macro is shown below and the other macros follow this pattern

macro_rules! log_fatal {
    ($($args:tt)*) => {
        eprintln!("\x1b[1;92m{} \x1b[30;41m[FATAL]: {} \x1b[0m",
            format!("[{}:{}]", file!(), line!()),
            format!($($args)*),
        );
    };
}

The macro can be used just like println but it gives some extra info (along with color)

#[macro_use]
extern crate rovella_logger;
...

log_fatal!("Fatal error with code: {}", 4); // output => [src\main.rs:2] [FATAL]: Fatal error with code: 4 
log_fatal!("Fatal");                        // output => [src\main.rs:3] [FATAL]: Fatal

Macros with a security level below error don't compile to anything in release mode

#[macro_use]
extern crate rovella_logger;
...

log_warn!("I'm only in debug mode {}", 4); // output => ...
log_info!("I'm only in deubg mode");       // output => ...
Commit count: 0

cargo fmt