Progress Log Manager

0.1.12 · active · verified Thu Apr 09

Proglog is a progress logging system for Python (current version 0.1.12). It enables developers to build complex libraries while offering users fine-grained control over logs, callbacks, and progress bars. It is actively maintained with releases focusing on build system improvements and documentation.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate `proglog` into a function to manage progress bars. It shows usage with the default console bar, an explicit `TqdmProgressBarLogger`, and disabling the bar. For Jupyter notebooks, `proglog.notebook()` should be called once to activate HTML bars.

import time
from proglog import default_bar_logger, TqdmProgressBarLogger

def my_processing_function(data_items=10, logger='bar'):
    """A function that simulates work and uses proglog for progress."""
    logger = default_bar_logger(logger) # Initialize logger based on input string or object
    results = []
    for i in logger.iter_bar(iterable=range(data_items), message="Processing data"): # Use 'iterable' for cleaner iteration
        # Simulate some computational work
        time.sleep(0.05)
        results.append(i * 2)
    return results

print("--- Running with default console progress bar ---")
my_processing_function(data_items=5)

print("\n--- Running with TQDM progress bar (explicitly passed) ---")
tqdm_logger_instance = TqdmProgressBarLogger() # Create an instance of a specific logger
my_processing_function(data_items=7, logger=tqdm_logger_instance)

print("\n--- Running with no progress bar ---")
my_processing_function(data_items=3, logger=None)

# To enable notebook specific bars, one would typically call proglog.notebook() once
# at the start of a Jupyter notebook session, before calling functions that use proglog.
# For example:
# import proglog
# proglog.notebook()
# my_processing_function(data_items=5)

view raw JSON →