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(__name__)

    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

Build the package

python -m pip install build
python -m build
python 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/*

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.1.tar.gz (5.0 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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logging_tee-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 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.1.tar.gz
Algorithm Hash digest
SHA256 be06b9deceb519d71c235eeaad1b24d8838665fa3b6363840706ae0d97d28836
MD5 1795fe9969d9b8b0a977bea597b4003b
BLAKE2b-256 60c16aed74efa554f36aba22a29716ea531562e7442b52f3a3b5d8f6d1deadd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_tee-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: logging_tee-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6949f117026c87f73330e4b6cec347c55b8cacb67856d414638aad171ba0201e
MD5 47d9a578b1b0cac0bd7317bf71b04a2a
BLAKE2b-256 20c5c55a7e0f1ae1015e2d62c96b1287bc78ce1ece70cfab1ea8b46f71e9ab5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_tee-1.0.1-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