4 releases
0.1.3 | Jun 1, 2023 |
---|---|
0.1.2 | Jul 31, 2022 |
0.1.1 | Oct 25, 2021 |
0.1.0 | Oct 18, 2021 |
#287 in Debugging
28 downloads per month
145KB
3.5K
SLoC
doclog
A Rust log library based on Rust's compiler logs.
Usage
The library is intended to be used building a Log
using a builder:
pub fn main() {
let content = "let a = \"test\"\nlet y = 3\nlet z = x + y";
let log = Log::info()
.title(
arcstr::literal!("A title"), /* show date */ true, /* show thread */ false,
)
.indent(|log| {
log.document_str(content, |doc| {
doc.highlight_section_str(37..38, Some("The variable 'y' must be a number"), None)
})
});
log.log();
}
This results in the following log in the terminal:
info at 2021-03-09T12:16:18.382Z - A title
┌─
│ 3 let z = x + y
│ └── The variable 'y' must be a number
└─
Dependencies
~2MB
~29K SLoC