A cross-platform Python library that adds colorful logging capabilities to the standard logging module
Project description
SmartLogger
A cross-platform Python library that adds beautiful, colorful logging capabilities to the standard Python logging module with zero configuration required.
Features
- 🎨 Colorful Logs: Each log level gets its distinctive color
- 🔧 Zero Configuration: Just import and it works automatically
- 🖥️ Cross-Platform: Works on Windows, macOS, and Linux
- 🏃 Performance Optimized: Minimal overhead on your application
- 🛡️ Safe: Won't break existing logging functionality
- 📱 Smart Detection: Automatically detects terminal capabilities
Installation
pip install pysmartlogger
Usage
Simply import smartlogger.auto and your existing logging will become colorful:
import logging
import smartlogger.auto
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
logger.debug("This is a debug message") # Blue
logger.info("This is an info message") # Green
logger.warning("This is a warning message") # Yellow
logger.error("This is an error message") # Red
logger.critical("This is a critical message") # Bright Red
Color Scheme
| Level | Color | Description |
|---|---|---|
| DEBUG | Blue | Development and debugging information |
| INFO | Green | General information messages |
| WARNING | Yellow | Warning messages for potential issues |
| ERROR | Red | Error messages for failures |
| CRITICAL | Bright Red | Critical errors requiring immediate attention |
Compatibility
- Python: 3.7+
- Operating Systems: Windows, macOS, Linux
- Terminals: CMD, PowerShell, bash, zsh, fish
- IDEs: VS Code, PyCharm, Jupyter, and more
How It Works
SmartLogger uses monkey-patching to enhance the standard logging module. When you import smartlogger.auto, it automatically:
- Detects if your environment supports colors
- Patches the logging formatters to add color codes
- Maintains full compatibility with existing logging configuration
License
MIT License - see LICENSE file for details.
Author
Mohammad Rasol Esfandiari
- GitHub: @DeepPythonist
- Email: mrasolesfandiari@gmail.com
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
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 pysmartlogger-1.2.0.tar.gz.
File metadata
- Download URL: pysmartlogger-1.2.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5f2956d2580e132b2bfead62c62471b5d50a7be1a60be7a2b93f16105623044
|
|
| MD5 |
215037722e10b73ae0ce810a6b3f206f
|
|
| BLAKE2b-256 |
51b99ef5bcace2e34ad5d878a107ad756310255a0793edf25340ec34904ae856
|
File details
Details for the file pysmartlogger-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pysmartlogger-1.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73f0b962d779259dbca25e35f9a83635542894c5ef5bcf2cec4c0eca562b0fc2
|
|
| MD5 |
533de9bb36366d7b002c6b7c14f1c961
|
|
| BLAKE2b-256 |
c11917a15a64784b41e6b26a85ec8e148ce9d19b803b031f08fcb2e39ff714f0
|