27 releases (15 stable)

7.0.0 Nov 6, 2022
6.0.0 Nov 4, 2022
5.0.2 Oct 3, 2022
5.0.1 Jun 25, 2022
0.2.3 Jul 30, 2020

#5 in #ll

Download history 86/week @ 2023-11-19 167/week @ 2023-11-26 47/week @ 2023-12-03 97/week @ 2023-12-10 78/week @ 2023-12-17 38/week @ 2023-12-31 21/week @ 2024-01-07 35/week @ 2024-01-14 70/week @ 2024-01-21 76/week @ 2024-01-28 76/week @ 2024-02-04 80/week @ 2024-02-11 98/week @ 2024-02-18 67/week @ 2024-02-25 112/week @ 2024-03-03

357 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

~5–16MB
~166K SLoC