Beautiful, colorful logging for Python — zero config
Project description
logpretty
Beautiful, colorful logging for Python — zero config
Before / After
Before (default Python logging):
INFO:root:Server started
WARNING:app.auth:Invalid token
ERROR:app.db:Connection failed
After (with logpretty):
14:32:05 INFO app.main Server started
14:32:06 WARNING app.auth Invalid token
14:32:07 ERROR app.db Connection failed
With colors: INFO is green, WARNING is yellow, ERROR is red.
Install
pip install logpretty
Usage
from logpretty import setup_logging, get_logger
setup_logging() # one line, done
logger = get_logger(__name__)
logger.info("Server started")
logger.warning("Slow query detected")
logger.error("Connection failed")
Features
- Colored output (auto-disabled in CI / pipes)
- Aligned columns for easy scanning
- Timestamps in HH:MM:SS format
- Long logger names auto-truncated
- Exception tracebacks included
- Zero dependencies — pure Python
- Drop-in replacement for
logging.basicConfig()
Configuration
setup_logging(
level="DEBUG", # log level
colors=True, # force colors on/off (auto by default)
show_time=True, # show/hide timestamp
show_name=True, # show/hide logger name
)
License
MIT
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
logpretty-0.1.0.tar.gz
(4.2 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 logpretty-0.1.0.tar.gz.
File metadata
- Download URL: logpretty-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8c87958643b9c2a89ba4b3e40fb816a6c9bbec04c60ac6a7f32d64381b4610d
|
|
| MD5 |
37a2256e5a69ed2aec18941dfaf5cb7e
|
|
| BLAKE2b-256 |
d4f892ba410a167c2f4c5567ac3e41a750afd82f046fc8617dd80f3ede19f866
|
File details
Details for the file logpretty-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logpretty-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2e6885aa25f339183fc577636e375ae9f4c89bc3994fe6f05f0fba809a08c4
|
|
| MD5 |
c74fef8501d298323d606178fe13387c
|
|
| BLAKE2b-256 |
fa8813e8afcf71fe64a2091b1dc0dd8a909ffe6cf140ed2bbaff8e5b6f757c97
|