#logging #clang #llvm

clang_log

Another log implementation

8 releases (stable)

Uses new Rust 2024

2.1.2 Jul 18, 2025
2.1.1 Apr 12, 2025
2.0.5 Nov 28, 2024
1.0.1 Nov 17, 2024
0.1.0 Nov 16, 2024

#410 in Debugging

Download history

780 downloads per month
Used in 2 crates

MIT license

9KB
98 lines

clang_log

docs.rs Crates.io Total Downloads Crates.io License Crates.io Dependents Crates.io Version

I really like the logging format of clang (pronounced klang, not C-lang), so I recreated it as an implementation of the log crate. It's licensed under the MIT license, and you can use it as you like. Use it, fork it, steal the code and sell it, I don't really care. If you find bugs, first of all, good job, because how can a logging implementation have bugs, and second of all, you can submit them to the issue tracker, or fix them and submit a PR. Additionally, if you want to improve clang_log, go ahead and waste five minuites writing a PR to change something.

How to use

To use clang_log, first include it, and log in Cargo.toml:

[dependencies]
log = "0.4.27"
clang_log = "2.1.2"

clang_log also has a feature flag; color. By removing this feature flag, you can remove color from the output.

[dependencies]
log = "0.4.27"
clang_log = { version = "2.1.2", default-features = false }

After adding clang_log to Cargo.toml, initialize it at the start of the program:

use log::Level;

fn main() {
    clang_log::init(Level::Trace, "clang")
}

You can also specify a minimum level to start outputting to stderr:

use log::Level;

fn main() {
    clang_log::init_error(Level::Trace, Level::Warn, "clang")
}

To use it, just use the macros provided by log

use log::*;

error!("Could not find files!");

Dependencies

~0–9.5MB
~49K SLoC