28 releases (16 stable)

7.1.0 Oct 15, 2024
7.0.0 Nov 6, 2022
6.0.0 Nov 4, 2022
5.0.2 Oct 3, 2022
0.2.3 Jul 30, 2020

#382 in Debugging

Download history 43/week @ 2024-07-04 90/week @ 2024-07-11 104/week @ 2024-07-18 108/week @ 2024-07-25 77/week @ 2024-08-01 71/week @ 2024-08-08 103/week @ 2024-08-15 173/week @ 2024-08-22 93/week @ 2024-08-29 82/week @ 2024-09-05 95/week @ 2024-09-12 198/week @ 2024-09-19 302/week @ 2024-09-26 204/week @ 2024-10-03 256/week @ 2024-10-10 222/week @ 2024-10-17

1,040 downloads per month

MIT license

75KB
2K SLoC

ll - Logging Library

ll is a lightweight logging library. Its main focus is to provide the ability to manually instrument portions of code to track and log its execution.

Instrumentation of the code is done by wrapping parts of code into Tasks. Tasks emit a start event when the task is started and end event when it's finished.

These events are consumed by Reporters. Multiple reporters can be used at the same time and they will each receive task events. Different reporters can report/log task events to different systems/sources, e.g. print them to STDOUT, write to a database, file or third-party system.

Tasks are organized in a task tree. Each task can spawn multiple subtasks and there's always parent-child relationship between them. TaskTree is the main struct that holds configuration for how to spawn/log/report tasks.

Example

use ll::Task;

async fn do_something() {
ll::reporters::term_status::show();

let root_task = Task::create_new("root_task");
root_task.spawn("subtask_1", |task| async move {
task.spawn_sync("subtask_2", |task| {
// do other stuff
Ok(())
})?;
Ok(())
}).await.unwrap();
}

Dependencies

~6–16MB
~218K SLoC