#progress-bar #tracing-layer #progress #tracing #logging-tracing

tracing-indicatif

Tracing layer that automatically creates and manages progress bars for active spans

11 releases

0.3.6 Dec 12, 2023
0.3.5 Aug 21, 2023
0.3.4 Apr 29, 2023
0.3.0 Feb 19, 2023
0.1.0 Feb 9, 2023

#72 in Command-line interface

Download history 2324/week @ 2024-07-24 2785/week @ 2024-07-31 3016/week @ 2024-08-07 3311/week @ 2024-08-14 3036/week @ 2024-08-21 3331/week @ 2024-08-28 3673/week @ 2024-09-04 3120/week @ 2024-09-11 3152/week @ 2024-09-18 3277/week @ 2024-09-25 3533/week @ 2024-10-02 3039/week @ 2024-10-09 3909/week @ 2024-10-16 3175/week @ 2024-10-23 3574/week @ 2024-10-30 2244/week @ 2024-11-06

13,418 downloads per month
Used in 30 crates (24 directly)

MIT license

76KB
1.5K SLoC

tracing-indicatif

Documentation Crates.io

A tracing layer that automatically creates and manages indicatif progress bars for active spans.

Progress bars are a great way to make your CLIs feel more responsive. However, adding and managing progress bars in your libraries can be invasive, unergonomic, and difficult to keep track of.

This library aims to make it easy to show progress bars for your CLI by tying progress bars to tracing spans. For CLIs/libraries already using tracing spans, this allow for a dead simple (3 line) code change to enable a smooth progress bar experience for your program. This eliminates having to have code in your libraries to manually manage progress bar instances.

This ends up working quite well as progress bars are fundamentally tracking the lifetime of some "span" (whether that "span" is defined explicitly or implicitly), so might as well make that relationship explicit.

Demo

See the examples folder for demo code.

Default Configuration

demo using basic example

Default Configuration with Child Spans

demo using child_spans example

Progress Bar

demo using progress_bar example

Build Console Like

A recreation of buck2's superconsole. demo using build_console example

Features

  • Customize progress bars using the same ProgressStyle API as indicatif.
  • Supports displaying parent-child span relationship between progress bars.
  • Limit the number of progress bars visible on the terminal.
  • Prevents progress bars from clobbering tracing logs.

Dependencies

~4–11MB
~113K SLoC