Crates.io | doclog |
lib.rs | doclog |
version | 0.1.3 |
source | src |
created_at | 2021-10-18 13:28:29.075883 |
updated_at | 2023-06-01 11:51:20.254378 |
description | A Rust log library based on Rust's compiler logs |
homepage | |
repository | https://github.com/juliotpaez/doclog |
max_upload_size | |
id | 466776 |
size | 146,732 |
A Rust log library based on Rust's compiler logs.
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
└─