Skip to main content

Logging utilities that work well with tqdm

Project description

Installation

pip install logging-tee

Usage

import logging
from tqdm import tqdm
import time

from logging_tee import setup_logger

if __name__ == "__main__":
    setup_logger(log_file="output.log", level=logging.DEBUG)
    logger = logging.getLogger()

    for i in tqdm(
        range(2),
        desc="Processing",
    ):
        time.sleep(0.03)
        logger.info("Processing item %d", i)

    for outer_idx in tqdm(
        range(2),
        desc="Outer",
    ):
        for inner_idx in tqdm(
            range(3),
            desc=f"Inner {outer_idx}",
        ):
            time.sleep(0.02)
            if inner_idx % 5 == 0:
                print(f"Nested step outer={outer_idx} inner={inner_idx}")
        logger.info(f"Completed outer={outer_idx}")

    print("from print statement")
    print("multiple lines\nfrom print statement 2")
    logger.debug("Single line")
    logger.debug("Multiple lines:\nnext line")
    logger.debug("Another single line")
    logger.debug("Multiple lines:\n%s", "next line\nnext line 2")
    logger.warning("Warning message\nwith multiple lines\nand should be logged properly.")
    logger.error("Error message\nwith multiple lines\nand should be logged properly.")
    raise ValueError("This is an error message\nwith multiple lines\nand should be logged properly.")

Contributing

Increase version in pyproject.toml file.

Build the package

python -m pip install build
python -m build
pip install dist/*.whl
python -c "import logging_tee; print(logging_tee)"

Upload to TestPyPI first

python -m pip install twine
python -m twine upload --repository testpypi dist/*
python -m pip install --index-url https://test.pypi.org/simple logging-tee

Upload to PyPi

python -m twine upload dist/*

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

logging_tee-1.0.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logging_tee-1.0.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file logging_tee-1.0.4.tar.gz.

File metadata

  • Download URL: logging_tee-1.0.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for logging_tee-1.0.4.tar.gz
Algorithm Hash digest
SHA256 117e9c4868aedd8cf83c2c8e84488502a84d593d90e458030ddd476a78d2defb
MD5 162b27c08f95685c8ec66280b022dccc
BLAKE2b-256 7987ba327f32eac12d01fd2e9070785aee30c7bdaa63afb8b283bb120a0d757b

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_tee-1.0.4.tar.gz:

Publisher: pypi.yml on jasonrichdarmawan/logging-tee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logging_tee-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: logging_tee-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for logging_tee-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 957d627eb80cd7fa93d78b63635fe7d55bb2a69864413740ed8e8d9b738b3085
MD5 50aeb80638ffba5a8184880fcbf6b5fb
BLAKE2b-256 914c19a33c363dd777d1dbafb015ee248ccbf4586144ef72a878c343ba070423

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_tee-1.0.4-py3-none-any.whl:

Publisher: pypi.yml on jasonrichdarmawan/logging-tee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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