Logging utilities that work well with tqdm
Project description
Installation
pip install logging-tee
Usage
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.")
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logging_tee-1.0.0.tar.gz.
File metadata
- Download URL: logging_tee-1.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d973167df4ec0b8bb205171f9e3cfc15f3abb956f323c030db94a8e6f88c861
|
|
| MD5 |
503d68865fee78dbd93792977fb5d280
|
|
| BLAKE2b-256 |
1ee4474dbe3b2e58383d7d725d6899b0426398c7722c781b2804cd613fccf2f4
|
File details
Details for the file logging_tee-1.0.0-py3-none-any.whl.
File metadata
- Download URL: logging_tee-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819773f406e810e31502212e3c6a6a7188d5ae505774d60be30599a801f0d1f7
|
|
| MD5 |
31247e877f3b4f8807488deed6284488
|
|
| BLAKE2b-256 |
258ab86d57faf8c0bad5ad851501123cc18c730652a8b523069f73dde9201061
|