A lean & hackable rich logger and print function.
Project description
print-on-steroids :weight_lifting_man:
A lean and hackable rich logger and print function.
Installation
pip install print-on-steroids
Features
- Easy switching between dev and prod modes for logging and an extra logging mode for publishing packages
- Rich meta-information for free like timestamps and originating line of code with clickable link
- Support for logging only on rank zero in distributed setups (e.g. Deep Learning)
Usage
from print_on_steroids import print_on_steroids as print, logger
# Enjoy enhanced print with optional log levels, timestamp, and originating line of code
print("It's like", "your regular", "Python print function", "but better", level="success")
# Logging with multiple processes - avoid terminal clutter
print("Gets printed", rank=0, rank0=True)
print("Doesn't get printed", rank=1, rank0=True)
# Full-fledged logger object out-of-the-box
logger.log("This", "is", "cool", level="info")
# or directly:
logger.info("This", "is", "cool")
logger.warning("This", "is", "dangerous")
logger.error("This", "is", "fatal")
...
# Easy setup for distributed setting:
logger.config(rank=RANK, print_rank0_only=True)
# Afterwards, the rank is remembered and does not need to be passed again
logger.success("Dataset processing finished!") # <-- this now prints only on rank zero
# For cleaner logs when publishing a package, use this:
logger.config(mode="package", package_name="torch")
# Dev logs can be turned on again like this:
logger.config(mode="dev")
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
Built Distribution
Close
Hashes for print_on_steroids-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c48053981327aee7b8efa6a9117fe8139c8c787bf4af3434b33424be8c256a4c |
|
MD5 | f66a09c56342cbd905e64dd5d41ecbe7 |
|
BLAKE2b-256 | 4feaab7642ac63f0056b7aecefb4a78945c25c1e788fcf5ab5e9973b49f9c474 |