#logger #env #env-logger #set

dev-logger

Based on env_logger but no need to set env

1 unstable release

0.1.0 Oct 21, 2023

#24 in #env-logger

MIT license

15KB
81 lines

Dev-logger

Based on env_logger but no need to set env.

Basic

examples/basic.rs:

use dev_logger;
#[macro_use]
extern crate log;

fn main() {
  dev_logger::init();
  function();
}

#[test]
fn test() {
  dev_logger::init();
  function();
}

fn function() {
  error!("error");
  warn!("warn");
  info!("info");
  debug!("debug");
  trace!("trace");
}

Trace

examples/trace.rs:

use dev_logger;
#[macro_use]
extern crate log;

fn main() {
  dev_logger::init_trace();
  function();
}

#[test]
fn test() {
  dev_logger::init_trace();
  function();
}

fn function() {
  error!("error");
  warn!("warn");
  info!("info");
  debug!("debug");
  trace!("trace");
}

Dependencies

~4–5.5MB
~89K SLoC