doclog

Crates.iodoclog
lib.rsdoclog
version0.1.3
sourcesrc
created_at2021-10-18 13:28:29.075883
updated_at2023-06-01 11:51:20.254378
descriptionA Rust log library based on Rust's compiler logs
homepage
repositoryhttps://github.com/juliotpaez/doclog
max_upload_size
id466776
size146,732
Julio Treviño Páez (juliotpaez)

documentation

https://docs.rs/doclog

README

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
    └─
Commit count: 33

cargo fmt