#log-messages #logging #formatter #terminal #back-end #log-error #debugging-logging

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

#59 in Command-line interface

Download history 1437/week @ 2024-11-16 2400/week @ 2024-11-23 2594/week @ 2024-11-30 2542/week @ 2024-12-07 2349/week @ 2024-12-14 1131/week @ 2024-12-21 1107/week @ 2024-12-28 1832/week @ 2025-01-04 2111/week @ 2025-01-11 2678/week @ 2025-01-18 1765/week @ 2025-01-25 2849/week @ 2025-02-01 2887/week @ 2025-02-08 2837/week @ 2025-02-15 2562/week @ 2025-02-22 1983/week @ 2025-03-01

10,742 downloads per month
Used in 37 crates (29 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
~38K SLoC