Skip to main content

A unified Logger and ProgressBar util with zero dependencies.

Project description

LogBar

A unified Logger and ProgressBar util with zero dependencies.

GitHub release PyPI - Version PyPI Downloads License

Features

  • Once logging: log.info.once("this log msg will be only logged once")
  • Progress Bar: progress_bar = log.pb(range(100))
  • Sticky Bottom Progress Bar: Default behavior!
  • Logging and Porgress Bar work hand-in-hand with no conflict: logs are printed before the progress bar

Usage:

# logs
log = LogBar.shared() # <-- single global log (optional), shared everywhere
log.info("super log!")
log.info.once("Show only once")
log.info.once("Show only once") # <-- not logged


# progress bar
pb = log.pb(range(100)) # <-- pass in any iterable
for _ in pb:
    time.sleep(0.1)

# advanced progress bar usage
# progress bar with fixed title
pb = log.pb(range(100)).title("Super Bar:") # <-- set fixed title
for _ in pb:
    time.sleep(0.1)


# advanced progress bar usage
# progress bar with fixed title and dynamic sub_title
# dynamic title/sub_title requires manual calls to `draw()` show progress correctly in correct order
pb = log.pb(range(names_list)).title("Processing Model").manual() # <-- switch to manual render mode: call `draw()` manually
for name in pb:
    start = time.time()
    log.info(f"{name} is about to be worked on...") # <-- logs and progress bar do not conflict
    pb.subtitle(f"Processing Module: {name}").draw()
    log.info(f"{name} completed: took {time.time()-start} secs")
    time.sleep(0.1)

Pending Features

  • Multiple Active Progress Bars

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logbar-0.0.4.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file logbar-0.0.4.tar.gz.

File metadata

  • Download URL: logbar-0.0.4.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for logbar-0.0.4.tar.gz
Algorithm Hash digest
SHA256 77117236e507cbd43b9e1d19f1042af56952f556496eabde7de184280d75414e
MD5 a91e707769d12fac880e7c88c5efdd69
BLAKE2b-256 a9dcad5d2dd05613ca93a0d6ea83c8ea173bbd1951983aab4565e9fa49d0862f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page