3 releases

0.1.1 Mar 9, 2021
0.1.1-rc.0 Dec 18, 2023
0.1.0 Dec 22, 2020

#485 in Encoding

Download history 6/week @ 2023-12-14 6/week @ 2024-02-15 61/week @ 2024-02-22 33/week @ 2024-02-29 11/week @ 2024-03-07 6/week @ 2024-03-14

113 downloads per month

MIT license

16KB
340 lines

PrimaRsLogger

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");
}

Dependencies

~6–17MB
~188K SLoC