prima_rs_logger

Crates.ioprima_rs_logger
lib.rsprima_rs_logger
version0.1.1-rc.0
sourcesrc
created_at2020-12-22 10:07:08.958439
updated_at2023-12-18 14:50:36.52607
descriptionPrima logging standard library
homepage
repositoryhttps://github.com/primait/prima_rs_logger
max_upload_size
id325882
size19,904
prima developers bot (primadev)

documentation

README

prima_rs_logger

Version Downloads Documentation

Installation

Just include prima_rs_logger = "^0.1" in your Cargo.toml

Code example

There are two different type of guards:

  • term guard => log stuff as plain string
  • json guard => encode everything in json format
use prima_rs_logger::{info, GuardLoggerCell};

// Singleton logger. Used to free user from manually passing Logger objects around.
static LOGGER_GUARD: GuardLoggerCell = GuardLoggerCell::new();

fn main() {
    let app_name: &str = "myapp";
    let guard = prima_rs_logger::term_guard(app_name);
    LOGGER_GUARD.set(guard).expect("Cannot set global logger guard");
    
    info!("Starting {}", app_name; "meta" => "data");
}
Commit count: 20

cargo fmt