#trace #formatter #info #styling #message #42 #initialization #system #colog #nhere

colog

The colog library is a simple formatter backend for the standard rust logging system (in the log crate)

7 releases (4 stable)

1.3.0 Mar 23, 2024
1.2.0 Mar 4, 2023
1.1.0 Sep 13, 2021
1.0.0 Feb 12, 2020
0.1.1 Apr 26, 2017

#29 in Value formatting

Download history 2121/week @ 2025-01-27 2732/week @ 2025-02-03 2684/week @ 2025-02-10 2889/week @ 2025-02-17 2459/week @ 2025-02-24 1915/week @ 2025-03-03 2322/week @ 2025-03-10 1815/week @ 2025-03-17 2188/week @ 2025-03-24 2420/week @ 2025-03-31 2159/week @ 2025-04-07 1901/week @ 2025-04-14 1816/week @ 2025-04-21 2369/week @ 2025-04-28 2310/week @ 2025-05-05 2083/week @ 2025-05-12

8,727 downloads per month
Used in 46 crates (36 directly)

LGPL-3.0

27KB
96 lines

Simple colored logger for rust

The colog library is a simple formatter backend for the standard rust logging system (in the log crate).

Getting started

use log::{error, warn, info, debug, trace};

fn main() {
    // Quick start: use default initialization
    colog::init();

    error!("error message");
    error!("error with fmt: {}", 42);
    warn!("warn message");
    info!("info message");
    debug!("debug message");
    trace!("trace message");

    info!("multi line demonstration\nhere");
    info!("more\nmulti\nline\nhere\nhere");
}

This results in the following terminal output:

demo screenshot from terminal

Custom styling

It's possible to override all colors and styles of colog.

See the following examples:

Also be sure to read the documentation (cargo doc --open) for a detailed description.

Known issues and improvements

There are no known, serious, unsolved issues.

Patches welcome :)

License

This project is licensed under the LGPLv3. See the file LICENSE for details.

Dependencies

~0.3–6.5MB
~37K SLoC