lovely_env_logger 0.5.0

a visually lovely env_logger
Documentation

A logger configured via environment variables which writes to standard error with nice colored output for log levels.

Example

extern crate lovely_env_logger;
#[macro_use] extern crate log;

fn main() {
lovely_env_logger::init_default();

trace!("a trace example");
debug!("deboogging");
info!("such information");
warn!("o_O");
error!("boom");
}

Run the program with the environment variable RUST_LOG=trace.

Defaults

The defaults can be setup by calling init_default() or try_init_default() at the start of the program.

Enable logging

This crate uses env_logger internally, so the same ways of enabling logs through an environment variable are supported.

Configuration through environment variables

Some options can be set through environment variables that have priority over configuration set through the Config structure.

The following options are set through environment variables named by adding a suffix added to RUST_LOG or the environment variable used to filter the traces.

RUST_LOG_WITH_TIMESTAMPS

Enable timestamps when set to 1. Disable it otherwise.

RUST_LOG_SHORT_LEVELS

Display levels on 3 characters to 1. Display them as 5 characters otherwise.

RUST_LOG_WITH_FILE_NAME

Display the file calling the log macro when set to 1. Disable it otherwise.

RUST_LOG_WITH_LINE_NUMBER

Display the line number calling the log macro when set to 1. Disable it otherwise.