A lovely (env) logger for Rust

Last year, I was not fully satisfied with a library I used to display logs in my Rust programs. It’s pretty-env-logger. I started patching the code but then I realized I had to change a lot of stuff and decided to make a fork of it. Some of my changes made the library too different from the original.

Goals

I had two main goals:

  1. have the log lines take less space,
  2. introduce some relative timestamping between log lines.

State of the library

I have released version 0.6.0 today and I consider it to be fully usable.

It relies on log to write traces in your code:

    debug!("some nice message to help debugging");
    info!("information");
    warn!("o_O");
    error!("boom");

And env-logger to be able to filter them.

Like the original, it can be customized at run time with environment variables.

Screenshots

Let me show you some examples as screenshots

Default output

default output

Output with relative timestamps, short levels (my favorite)

example output with relative timestamps, short levels

Output with system timestamps, file names and line numbers

example output with system timestamps, file names and line numbers

I hope it will be useful to some of you.