|
1 | 1 | # SmartLogger |
2 | 2 |
|
3 | | -A colorful logging extension for Python's built-in logging module. |
| 3 | +A cross-platform Python library that adds beautiful, colorful logging capabilities to the standard Python logging module with zero configuration required. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- 🎨 Colorful log output |
8 | | -- 🔧 Easy integration with existing logging code |
9 | | -- ⚙️ Customizable color schemes |
10 | | -- 🚀 Zero-configuration auto-discovery |
11 | | -- 💻 Cross-platform terminal support |
| 7 | +- 🎨 **Colorful Logs**: Each log level gets its distinctive color |
| 8 | +- 🔧 **Zero Configuration**: Just import and it works automatically |
| 9 | +- 🖥️ **Cross-Platform**: Works on Windows, macOS, and Linux |
| 10 | +- 🏃 **Performance Optimized**: Minimal overhead on your application |
| 11 | +- 🛡️ **Safe**: Won't break existing logging functionality |
| 12 | +- 📱 **Smart Detection**: Automatically detects terminal capabilities |
12 | 13 |
|
13 | 14 | ## Installation |
14 | 15 |
|
15 | 16 | ```bash |
16 | | -pip install smartlogger |
| 17 | +pip install pysmartlogger |
17 | 18 | ``` |
18 | 19 |
|
19 | | -## Quick Start |
| 20 | +## Usage |
| 21 | + |
| 22 | +Simply import `smartlogger.auto` and your existing logging will become colorful: |
20 | 23 |
|
21 | 24 | ```python |
22 | | -import smartlogger.auto |
23 | 25 | import logging |
| 26 | +import smartlogger.auto |
24 | 27 |
|
25 | | -# Your existing logging code now has colors! |
26 | 28 | logging.basicConfig(level=logging.DEBUG) |
27 | 29 | logger = logging.getLogger(__name__) |
28 | 30 |
|
29 | | -logger.debug("Debug message") |
30 | | -logger.info("Info message") |
31 | | -logger.warning("Warning message") |
32 | | -logger.error("Error message") |
33 | | -logger.critical("Critical message") |
| 31 | +logger.debug("This is a debug message") # Blue |
| 32 | +logger.info("This is an info message") # Green |
| 33 | +logger.warning("This is a warning message") # Yellow |
| 34 | +logger.error("This is an error message") # Red |
| 35 | +logger.critical("This is a critical message") # Bright Red |
34 | 36 | ``` |
35 | 37 |
|
| 38 | +## Color Scheme |
| 39 | + |
| 40 | +| Level | Color | Description | |
| 41 | +|-------|-------|-------------| |
| 42 | +| DEBUG | Blue | Development and debugging information | |
| 43 | +| INFO | Green | General information messages | |
| 44 | +| WARNING | Yellow | Warning messages for potential issues | |
| 45 | +| ERROR | Red | Error messages for failures | |
| 46 | +| CRITICAL | Bright Red | Critical errors requiring immediate attention | |
| 47 | + |
| 48 | +## Compatibility |
| 49 | + |
| 50 | +- **Python**: 3.7+ |
| 51 | +- **Operating Systems**: Windows, macOS, Linux |
| 52 | +- **Terminals**: CMD, PowerShell, bash, zsh, fish |
| 53 | +- **IDEs**: VS Code, PyCharm, Jupyter, and more |
| 54 | + |
| 55 | +## How It Works |
| 56 | + |
| 57 | +SmartLogger uses monkey-patching to enhance the standard logging module. When you import `smartlogger.auto`, it automatically: |
| 58 | + |
| 59 | +1. Detects if your environment supports colors |
| 60 | +2. Patches the logging formatters to add color codes |
| 61 | +3. Maintains full compatibility with existing logging configuration |
| 62 | + |
36 | 63 | ## License |
37 | 64 |
|
38 | | -MIT License |
| 65 | +MIT License - see [LICENSE](LICENSE) file for details. |
| 66 | + |
| 67 | +## Author |
| 68 | + |
| 69 | +**Mohammad Rasol Esfandiari** |
| 70 | +- GitHub: [@DeepPythonist](https://github.com/DeepPythonist) |
| 71 | +- Email: mrasolesfandiari@gmail.com |
0 commit comments