Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliotpaez/doclog
A Rust log library based on Rust's compiler logs.
https://github.com/juliotpaez/doclog
Last synced: about 2 months ago
JSON representation
A Rust log library based on Rust's compiler logs.
- Host: GitHub
- URL: https://github.com/juliotpaez/doclog
- Owner: juliotpaez
- License: mit
- Created: 2021-02-18T10:56:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T15:38:11.000Z (3 months ago)
- Last Synced: 2024-10-31T11:59:55.145Z (about 2 months ago)
- Language: Rust
- Size: 259 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```rust
pub fn main() {
let code = "let a = \"test\"\nlet y = 3\nlet z = x + y";
let log = Log::error().add_block(
HeaderBlock::new().title("Invalid variable type").location("/lib.rs").show_date(true).show_thread(false),
).add_block(
PrefixBlock::new().prefix(" ").content(LogContent::new().add_block(
CodeBlock::new(code).highlight_section_message(
37..38,
None,
"The variable 'y' must be a number",
),
)),
);log.log();
}
```This results in the following log in the terminal:
```
ERROR Invalid variable type
↪ in /lib.rs
↪ at 2024-09-01T20:37:18.495Z
× ╭─
3 │ let z = x + y
│ ╰── The variable 'y' must be a number
╰─
```