ezplog 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ezplog-1.2.0/LICENSE +21 -0
- ezplog-1.2.0/PKG-INFO +226 -0
- ezplog-1.2.0/README.md +178 -0
- ezplog-1.2.0/ezpl/__init__.py +184 -0
- ezplog-1.2.0/ezpl/cli/__init__.py +26 -0
- ezplog-1.2.0/ezpl/cli/commands/__init__.py +31 -0
- ezplog-1.2.0/ezpl/cli/commands/config.py +210 -0
- ezplog-1.2.0/ezpl/cli/commands/info.py +151 -0
- ezplog-1.2.0/ezpl/cli/commands/logs.py +635 -0
- ezplog-1.2.0/ezpl/cli/commands/version.py +92 -0
- ezplog-1.2.0/ezpl/cli/main.py +127 -0
- ezplog-1.2.0/ezpl/cli/utils/__init__.py +40 -0
- ezplog-1.2.0/ezpl/cli/utils/env_manager.py +250 -0
- ezplog-1.2.0/ezpl/cli/utils/log_parser.py +253 -0
- ezplog-1.2.0/ezpl/cli/utils/log_stats.py +152 -0
- ezplog-1.2.0/ezpl/config/__init__.py +27 -0
- ezplog-1.2.0/ezpl/config/defaults.py +184 -0
- ezplog-1.2.0/ezpl/config/manager.py +324 -0
- ezplog-1.2.0/ezpl/core/__init__.py +56 -0
- ezplog-1.2.0/ezpl/core/exceptions.py +197 -0
- ezplog-1.2.0/ezpl/core/interfaces.py +148 -0
- ezplog-1.2.0/ezpl/ezpl.py +668 -0
- ezplog-1.2.0/ezpl/handlers/__init__.py +41 -0
- ezplog-1.2.0/ezpl/handlers/console.py +552 -0
- ezplog-1.2.0/ezpl/handlers/file.py +372 -0
- ezplog-1.2.0/ezpl/handlers/utils.py +110 -0
- ezplog-1.2.0/ezpl/handlers/wizard/__init__.py +26 -0
- ezplog-1.2.0/ezpl/handlers/wizard/core.py +79 -0
- ezplog-1.2.0/ezpl/handlers/wizard/dynamic.py +680 -0
- ezplog-1.2.0/ezpl/handlers/wizard/json.py +105 -0
- ezplog-1.2.0/ezpl/handlers/wizard/panels.py +265 -0
- ezplog-1.2.0/ezpl/handlers/wizard/progress.py +659 -0
- ezplog-1.2.0/ezpl/handlers/wizard/tables.py +229 -0
- ezplog-1.2.0/ezpl/types/__init__.py +38 -0
- ezplog-1.2.0/ezpl/types/log_level.py +244 -0
- ezplog-1.2.0/ezpl/types/patterns.py +97 -0
- ezplog-1.2.0/ezpl/utils/__init__.py +11 -0
- ezplog-1.2.0/ezplog.egg-info/PKG-INFO +226 -0
- ezplog-1.2.0/ezplog.egg-info/SOURCES.txt +43 -0
- ezplog-1.2.0/ezplog.egg-info/dependency_links.txt +1 -0
- ezplog-1.2.0/ezplog.egg-info/entry_points.txt +2 -0
- ezplog-1.2.0/ezplog.egg-info/requires.txt +23 -0
- ezplog-1.2.0/ezplog.egg-info/top_level.txt +1 -0
- ezplog-1.2.0/pyproject.toml +314 -0
- ezplog-1.2.0/setup.cfg +4 -0
ezplog-1.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Neuraaak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ezplog-1.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ezplog
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Modern Python logging framework with Rich console output and loguru file logging, featuring advanced display capabilities, configuration management, and a simple typed API.
|
|
5
|
+
Author: Neuraaak
|
|
6
|
+
Maintainer: Neuraaak
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/neuraaak/ezpl
|
|
9
|
+
Project-URL: Repository, https://github.com/neuraaak/ezpl
|
|
10
|
+
Keywords: logging,rich,loguru,console,file,framework,cli
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Topic :: System :: Logging
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: loguru>=0.7.2
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Requires-Dist: click>=8.0.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: bandit>=1.7.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
42
|
+
Provides-Extra: test
|
|
43
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
45
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-xdist>=3.0.0; extra == "test"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# 🚀 Ezpl
|
|
50
|
+
|
|
51
|
+
[](https://www.python.org/)
|
|
52
|
+
[](https://pypi.org/project/ezpl/)
|
|
53
|
+
[](https://github.com/neuraaak/ezpl)
|
|
54
|
+
[](LICENSE)
|
|
55
|
+
[](https://github.com/neuraaak/ezpl)
|
|
56
|
+
[](https://github.com/neuraaak/ezpl)
|
|
57
|
+
|
|
58
|
+
**Ezpl** is a modern Python logging framework with **Rich** console output and **loguru** file logging, featuring advanced display capabilities, configuration management, and a simple typed API suitable for professional and industrial applications.
|
|
59
|
+
|
|
60
|
+
## 📦 Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install ezpl
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or from source:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/neuraaak/ezpl.git
|
|
70
|
+
cd ezpl && pip install .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 🚀 Quick Start
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from ezpl import Ezpl
|
|
77
|
+
|
|
78
|
+
# Initialize
|
|
79
|
+
ezpl = Ezpl(log_file="app.log")
|
|
80
|
+
printer = ezpl.get_printer()
|
|
81
|
+
logger = ezpl.get_logger()
|
|
82
|
+
|
|
83
|
+
# Console output (Rich formatting)
|
|
84
|
+
printer.info("Information message")
|
|
85
|
+
printer.success("Operation completed!")
|
|
86
|
+
printer.warning("Warning message")
|
|
87
|
+
|
|
88
|
+
# File logging (loguru)
|
|
89
|
+
logger.info("Logged to file")
|
|
90
|
+
|
|
91
|
+
# Advanced features
|
|
92
|
+
printer.wizard.success_panel("Success", "Operation completed")
|
|
93
|
+
printer.wizard.table([{"Name": "Alice", "Age": 30}], title="Users")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 🎯 Key Features
|
|
97
|
+
|
|
98
|
+
- **✅ Singleton Pattern**: One global instance for the whole application
|
|
99
|
+
- **✅ Rich Console Output**: Beautiful formatting with colors, panels, tables, and progress bars
|
|
100
|
+
- **✅ File Logging**: Structured logs with rotation, retention, and compression
|
|
101
|
+
- **✅ RichWizard**: Advanced display capabilities (panels, tables, JSON, dynamic progress bars)
|
|
102
|
+
- **✅ Configuration Management**: JSON config, environment variables, and runtime configuration
|
|
103
|
+
- **✅ CLI Tools**: Command-line interface for logs, config, and statistics
|
|
104
|
+
- **✅ Full Type Hints**: Complete typing support for IDEs and linters
|
|
105
|
+
- **✅ Robust Error Handling**: Never crashes, even with problematic input
|
|
106
|
+
|
|
107
|
+
## 📚 Documentation
|
|
108
|
+
|
|
109
|
+
- **[📖 Complete API Documentation](docs/api/API_DOCUMENTATION.md)** – Full API reference with examples
|
|
110
|
+
- **[📋 API Summary](docs/api/SUMMARY.md)** – Quick API overview
|
|
111
|
+
- **[🖥️ CLI Documentation](docs/cli/CLI_DOCUMENTATION.md)** – Command-line interface guide
|
|
112
|
+
- **[⚙️ Configuration Guide](docs/cli/CONFIG_GUIDE.md)** – Configuration management
|
|
113
|
+
- **[💡 Examples](docs/examples/EXAMPLES.md)** – Usage examples and demonstrations
|
|
114
|
+
- **[🧪 Test Documentation](docs/tests/TEST_DOCUMENTATION.md)** – Complete test suite documentation
|
|
115
|
+
- **[📊 Test Summary](docs/tests/SUMMARY.md)** – Quick test overview
|
|
116
|
+
|
|
117
|
+
## 🧪 Testing
|
|
118
|
+
|
|
119
|
+
Comprehensive test suite with 200+ test cases covering unit, integration, and robustness scenarios.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Install dev dependencies
|
|
123
|
+
pip install -e ".[dev]"
|
|
124
|
+
|
|
125
|
+
# Run all tests
|
|
126
|
+
pytest tests/
|
|
127
|
+
|
|
128
|
+
# Run specific test types
|
|
129
|
+
python tests/run_tests.py --type unit
|
|
130
|
+
python tests/run_tests.py --type integration
|
|
131
|
+
python tests/run_tests.py --type robustness
|
|
132
|
+
|
|
133
|
+
# With coverage
|
|
134
|
+
python tests/run_tests.py --coverage
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See **[Test Documentation](docs/tests/TEST_DOCUMENTATION.md)** for complete details.
|
|
138
|
+
|
|
139
|
+
## 🛠️ Development Setup
|
|
140
|
+
|
|
141
|
+
For contributors and developers:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Install in development mode with all dependencies
|
|
145
|
+
pip install -e ".[dev]"
|
|
146
|
+
|
|
147
|
+
# Install pre-commit hooks (code formatting, linting)
|
|
148
|
+
pip install pre-commit
|
|
149
|
+
pre-commit install
|
|
150
|
+
|
|
151
|
+
# Install Git hooks (auto-formatting, auto-tagging)
|
|
152
|
+
# Linux/macOS:
|
|
153
|
+
./.hooks/install.sh
|
|
154
|
+
|
|
155
|
+
# Windows:
|
|
156
|
+
.hooks\install.bat
|
|
157
|
+
|
|
158
|
+
# Or manually:
|
|
159
|
+
git config core.hooksPath .hooks
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Git Hooks:**
|
|
163
|
+
- **pre-commit**: Automatically formats code (black, isort, ruff) before commit
|
|
164
|
+
- **post-commit**: Automatically creates version tags after commit
|
|
165
|
+
|
|
166
|
+
See **[.hooks/README.md](.hooks/README.md)** for detailed hook documentation.
|
|
167
|
+
|
|
168
|
+
## 🎨 Main Components
|
|
169
|
+
|
|
170
|
+
- **`Ezpl`**: Singleton main class for centralized logging management
|
|
171
|
+
- **`Printer`** (ConsolePrinterWrapper): Rich-based console output with pattern format
|
|
172
|
+
- **`FileLogger`**: loguru-based file logging with rotation support
|
|
173
|
+
- **`RichWizard`**: Advanced Rich display (panels, tables, JSON, progress bars)
|
|
174
|
+
- **`ConfigurationManager`**: Centralized configuration management
|
|
175
|
+
|
|
176
|
+
## 📦 Dependencies
|
|
177
|
+
|
|
178
|
+
- **rich>=13.0.0** – Beautiful console output and formatting
|
|
179
|
+
- **loguru>=0.7.2** – Modern and powerful file logging
|
|
180
|
+
- **click>=8.0.0** – CLI framework
|
|
181
|
+
|
|
182
|
+
## 🔧 Quick API Reference
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
from ezpl import Ezpl, Printer
|
|
186
|
+
from loguru import Logger
|
|
187
|
+
|
|
188
|
+
ezpl = Ezpl()
|
|
189
|
+
printer: Printer = ezpl.get_printer()
|
|
190
|
+
logger: Logger = ezpl.get_logger()
|
|
191
|
+
|
|
192
|
+
# Console methods
|
|
193
|
+
printer.info(), printer.success(), printer.warning(), printer.error()
|
|
194
|
+
printer.tip(), printer.system(), printer.install() # Pattern methods
|
|
195
|
+
printer.wizard.panel(), printer.wizard.table(), printer.wizard.json()
|
|
196
|
+
|
|
197
|
+
# File logging
|
|
198
|
+
logger.info(), logger.debug(), logger.warning(), logger.error()
|
|
199
|
+
|
|
200
|
+
# Configuration
|
|
201
|
+
ezpl.set_level("DEBUG")
|
|
202
|
+
ezpl.configure(log_rotation="10 MB", log_retention="7 days")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 🛡️ Robustness
|
|
206
|
+
|
|
207
|
+
Ezpl is designed to never crash, even with problematic input:
|
|
208
|
+
|
|
209
|
+
- Automatic string conversion for non-string messages
|
|
210
|
+
- Robust error handling in formatters
|
|
211
|
+
- Safe handling of special characters and Unicode
|
|
212
|
+
- Graceful fallbacks for all error cases
|
|
213
|
+
|
|
214
|
+
## 📝 License
|
|
215
|
+
|
|
216
|
+
MIT License – See [LICENSE](LICENSE) file for details.
|
|
217
|
+
|
|
218
|
+
## 🔗 Links
|
|
219
|
+
|
|
220
|
+
- **Repository**: [https://github.com/neuraaak/ezpl](https://github.com/neuraaak/ezpl)
|
|
221
|
+
- **Issues**: [GitHub Issues](https://github.com/neuraaak/ezpl/issues)
|
|
222
|
+
- **Documentation**: [Complete API Docs](docs/api/API_DOCUMENTATION.md)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
**Ezpl** – Modern, typed, robust and beautiful logging for Python. 🚀
|
ezplog-1.2.0/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# 🚀 Ezpl
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/)
|
|
4
|
+
[](https://pypi.org/project/ezpl/)
|
|
5
|
+
[](https://github.com/neuraaak/ezpl)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/neuraaak/ezpl)
|
|
8
|
+
[](https://github.com/neuraaak/ezpl)
|
|
9
|
+
|
|
10
|
+
**Ezpl** is a modern Python logging framework with **Rich** console output and **loguru** file logging, featuring advanced display capabilities, configuration management, and a simple typed API suitable for professional and industrial applications.
|
|
11
|
+
|
|
12
|
+
## 📦 Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install ezpl
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or from source:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/neuraaak/ezpl.git
|
|
22
|
+
cd ezpl && pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🚀 Quick Start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from ezpl import Ezpl
|
|
29
|
+
|
|
30
|
+
# Initialize
|
|
31
|
+
ezpl = Ezpl(log_file="app.log")
|
|
32
|
+
printer = ezpl.get_printer()
|
|
33
|
+
logger = ezpl.get_logger()
|
|
34
|
+
|
|
35
|
+
# Console output (Rich formatting)
|
|
36
|
+
printer.info("Information message")
|
|
37
|
+
printer.success("Operation completed!")
|
|
38
|
+
printer.warning("Warning message")
|
|
39
|
+
|
|
40
|
+
# File logging (loguru)
|
|
41
|
+
logger.info("Logged to file")
|
|
42
|
+
|
|
43
|
+
# Advanced features
|
|
44
|
+
printer.wizard.success_panel("Success", "Operation completed")
|
|
45
|
+
printer.wizard.table([{"Name": "Alice", "Age": 30}], title="Users")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 🎯 Key Features
|
|
49
|
+
|
|
50
|
+
- **✅ Singleton Pattern**: One global instance for the whole application
|
|
51
|
+
- **✅ Rich Console Output**: Beautiful formatting with colors, panels, tables, and progress bars
|
|
52
|
+
- **✅ File Logging**: Structured logs with rotation, retention, and compression
|
|
53
|
+
- **✅ RichWizard**: Advanced display capabilities (panels, tables, JSON, dynamic progress bars)
|
|
54
|
+
- **✅ Configuration Management**: JSON config, environment variables, and runtime configuration
|
|
55
|
+
- **✅ CLI Tools**: Command-line interface for logs, config, and statistics
|
|
56
|
+
- **✅ Full Type Hints**: Complete typing support for IDEs and linters
|
|
57
|
+
- **✅ Robust Error Handling**: Never crashes, even with problematic input
|
|
58
|
+
|
|
59
|
+
## 📚 Documentation
|
|
60
|
+
|
|
61
|
+
- **[📖 Complete API Documentation](docs/api/API_DOCUMENTATION.md)** – Full API reference with examples
|
|
62
|
+
- **[📋 API Summary](docs/api/SUMMARY.md)** – Quick API overview
|
|
63
|
+
- **[🖥️ CLI Documentation](docs/cli/CLI_DOCUMENTATION.md)** – Command-line interface guide
|
|
64
|
+
- **[⚙️ Configuration Guide](docs/cli/CONFIG_GUIDE.md)** – Configuration management
|
|
65
|
+
- **[💡 Examples](docs/examples/EXAMPLES.md)** – Usage examples and demonstrations
|
|
66
|
+
- **[🧪 Test Documentation](docs/tests/TEST_DOCUMENTATION.md)** – Complete test suite documentation
|
|
67
|
+
- **[📊 Test Summary](docs/tests/SUMMARY.md)** – Quick test overview
|
|
68
|
+
|
|
69
|
+
## 🧪 Testing
|
|
70
|
+
|
|
71
|
+
Comprehensive test suite with 200+ test cases covering unit, integration, and robustness scenarios.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Install dev dependencies
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
|
|
77
|
+
# Run all tests
|
|
78
|
+
pytest tests/
|
|
79
|
+
|
|
80
|
+
# Run specific test types
|
|
81
|
+
python tests/run_tests.py --type unit
|
|
82
|
+
python tests/run_tests.py --type integration
|
|
83
|
+
python tests/run_tests.py --type robustness
|
|
84
|
+
|
|
85
|
+
# With coverage
|
|
86
|
+
python tests/run_tests.py --coverage
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See **[Test Documentation](docs/tests/TEST_DOCUMENTATION.md)** for complete details.
|
|
90
|
+
|
|
91
|
+
## 🛠️ Development Setup
|
|
92
|
+
|
|
93
|
+
For contributors and developers:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Install in development mode with all dependencies
|
|
97
|
+
pip install -e ".[dev]"
|
|
98
|
+
|
|
99
|
+
# Install pre-commit hooks (code formatting, linting)
|
|
100
|
+
pip install pre-commit
|
|
101
|
+
pre-commit install
|
|
102
|
+
|
|
103
|
+
# Install Git hooks (auto-formatting, auto-tagging)
|
|
104
|
+
# Linux/macOS:
|
|
105
|
+
./.hooks/install.sh
|
|
106
|
+
|
|
107
|
+
# Windows:
|
|
108
|
+
.hooks\install.bat
|
|
109
|
+
|
|
110
|
+
# Or manually:
|
|
111
|
+
git config core.hooksPath .hooks
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Git Hooks:**
|
|
115
|
+
- **pre-commit**: Automatically formats code (black, isort, ruff) before commit
|
|
116
|
+
- **post-commit**: Automatically creates version tags after commit
|
|
117
|
+
|
|
118
|
+
See **[.hooks/README.md](.hooks/README.md)** for detailed hook documentation.
|
|
119
|
+
|
|
120
|
+
## 🎨 Main Components
|
|
121
|
+
|
|
122
|
+
- **`Ezpl`**: Singleton main class for centralized logging management
|
|
123
|
+
- **`Printer`** (ConsolePrinterWrapper): Rich-based console output with pattern format
|
|
124
|
+
- **`FileLogger`**: loguru-based file logging with rotation support
|
|
125
|
+
- **`RichWizard`**: Advanced Rich display (panels, tables, JSON, progress bars)
|
|
126
|
+
- **`ConfigurationManager`**: Centralized configuration management
|
|
127
|
+
|
|
128
|
+
## 📦 Dependencies
|
|
129
|
+
|
|
130
|
+
- **rich>=13.0.0** – Beautiful console output and formatting
|
|
131
|
+
- **loguru>=0.7.2** – Modern and powerful file logging
|
|
132
|
+
- **click>=8.0.0** – CLI framework
|
|
133
|
+
|
|
134
|
+
## 🔧 Quick API Reference
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from ezpl import Ezpl, Printer
|
|
138
|
+
from loguru import Logger
|
|
139
|
+
|
|
140
|
+
ezpl = Ezpl()
|
|
141
|
+
printer: Printer = ezpl.get_printer()
|
|
142
|
+
logger: Logger = ezpl.get_logger()
|
|
143
|
+
|
|
144
|
+
# Console methods
|
|
145
|
+
printer.info(), printer.success(), printer.warning(), printer.error()
|
|
146
|
+
printer.tip(), printer.system(), printer.install() # Pattern methods
|
|
147
|
+
printer.wizard.panel(), printer.wizard.table(), printer.wizard.json()
|
|
148
|
+
|
|
149
|
+
# File logging
|
|
150
|
+
logger.info(), logger.debug(), logger.warning(), logger.error()
|
|
151
|
+
|
|
152
|
+
# Configuration
|
|
153
|
+
ezpl.set_level("DEBUG")
|
|
154
|
+
ezpl.configure(log_rotation="10 MB", log_retention="7 days")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 🛡️ Robustness
|
|
158
|
+
|
|
159
|
+
Ezpl is designed to never crash, even with problematic input:
|
|
160
|
+
|
|
161
|
+
- Automatic string conversion for non-string messages
|
|
162
|
+
- Robust error handling in formatters
|
|
163
|
+
- Safe handling of special characters and Unicode
|
|
164
|
+
- Graceful fallbacks for all error cases
|
|
165
|
+
|
|
166
|
+
## 📝 License
|
|
167
|
+
|
|
168
|
+
MIT License – See [LICENSE](LICENSE) file for details.
|
|
169
|
+
|
|
170
|
+
## 🔗 Links
|
|
171
|
+
|
|
172
|
+
- **Repository**: [https://github.com/neuraaak/ezpl](https://github.com/neuraaak/ezpl)
|
|
173
|
+
- **Issues**: [GitHub Issues](https://github.com/neuraaak/ezpl/issues)
|
|
174
|
+
- **Documentation**: [Complete API Docs](docs/api/API_DOCUMENTATION.md)
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
**Ezpl** – Modern, typed, robust and beautiful logging for Python. 🚀
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ezpl - Modern Python logging framework.
|
|
3
|
+
|
|
4
|
+
Ezpl is a modern Python library for advanced log management, using **Rich**
|
|
5
|
+
for console output and **loguru** for file logging, with a simple and typed API,
|
|
6
|
+
suitable for professional and industrial applications.
|
|
7
|
+
|
|
8
|
+
**Main Features:**
|
|
9
|
+
- Singleton pattern for global logging instance
|
|
10
|
+
- Rich-based console output with colors and formatting
|
|
11
|
+
- Loguru-based file logging with rotation support
|
|
12
|
+
- Contextual indentation management
|
|
13
|
+
- Pattern-based logging (SUCCESS, ERROR, WARN, TIP, etc.)
|
|
14
|
+
- JSON display support
|
|
15
|
+
- Robust error handling
|
|
16
|
+
|
|
17
|
+
**Quick Start:**
|
|
18
|
+
>>> from ezpl import Ezpl
|
|
19
|
+
>>> ezpl = Ezpl()
|
|
20
|
+
>>> printer = ezpl.get_printer()
|
|
21
|
+
>>> logger = ezpl.get_logger()
|
|
22
|
+
>>> printer.info("Hello, Ezpl!")
|
|
23
|
+
>>> logger.info("Logged to file")
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
import sys
|
|
29
|
+
|
|
30
|
+
# =============================================================================
|
|
31
|
+
# META INFORMATIONS
|
|
32
|
+
# =============================================================================
|
|
33
|
+
|
|
34
|
+
__version__ = "1.2.0"
|
|
35
|
+
__author__ = "Neuraaak"
|
|
36
|
+
__maintainer__ = "Neuraaak"
|
|
37
|
+
__license__ = "MIT"
|
|
38
|
+
__description__ = "A module for easier logging"
|
|
39
|
+
__keywords__ = ["logging", "rich", "loguru", "console", "file"]
|
|
40
|
+
__url__ = "https://github.com/neuraaak/ezpl"
|
|
41
|
+
__repository__ = "https://github.com/neuraaak/ezpl"
|
|
42
|
+
__python_requires__ = ">=3.10"
|
|
43
|
+
|
|
44
|
+
# =============================================================================
|
|
45
|
+
# PYTHON VERSION CHECK
|
|
46
|
+
# =============================================================================
|
|
47
|
+
|
|
48
|
+
if sys.version_info < (3, 10):
|
|
49
|
+
raise RuntimeError(
|
|
50
|
+
f"ezpl {__version__} requires Python 3.10 or higher. "
|
|
51
|
+
f"Current version: {sys.version}"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# =============================================================================
|
|
55
|
+
# IMPORTS
|
|
56
|
+
# =============================================================================
|
|
57
|
+
|
|
58
|
+
# ------------------------------------------------
|
|
59
|
+
# CORE CONFIG & EXCEPTIONS
|
|
60
|
+
# ------------------------------------------------
|
|
61
|
+
from .config import ConfigurationManager
|
|
62
|
+
from .core.exceptions import (
|
|
63
|
+
ConfigurationError,
|
|
64
|
+
EzplError,
|
|
65
|
+
FileOperationError,
|
|
66
|
+
HandlerError,
|
|
67
|
+
InitializationError,
|
|
68
|
+
LoggingError,
|
|
69
|
+
ValidationError,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# ------------------------------------------------
|
|
73
|
+
# MAIN CLASS & HANDLERS
|
|
74
|
+
# ------------------------------------------------
|
|
75
|
+
from .ezpl import Ezpl
|
|
76
|
+
from .handlers import ConsolePrinter, EzLogger, EzPrinter, FileLogger, RichWizard
|
|
77
|
+
from .handlers.console import ConsolePrinterWrapper
|
|
78
|
+
|
|
79
|
+
# ------------------------------------------------
|
|
80
|
+
# TYPES
|
|
81
|
+
# ------------------------------------------------
|
|
82
|
+
from .types import (
|
|
83
|
+
PATTERN_COLORS,
|
|
84
|
+
LogLevel,
|
|
85
|
+
Pattern,
|
|
86
|
+
get_pattern_color,
|
|
87
|
+
get_pattern_color_by_name,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# =============================================================================
|
|
91
|
+
# TYPE ALIASES
|
|
92
|
+
# =============================================================================
|
|
93
|
+
|
|
94
|
+
# Canonical type aliases for users.
|
|
95
|
+
# They mirror the internal EzPrinter / EzLogger types.
|
|
96
|
+
|
|
97
|
+
# ------------------------------------------------
|
|
98
|
+
# PRINTER TYPE ALIAS
|
|
99
|
+
# ------------------------------------------------
|
|
100
|
+
Printer = EzPrinter
|
|
101
|
+
"""Type alias for EzPrinter (console printer handler).
|
|
102
|
+
Use this type when you want to annotate a variable that represents a printer.
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
>>> from ezpl import Ezpl, Printer
|
|
106
|
+
>>> ezpl = Ezpl()
|
|
107
|
+
>>> printer: Printer = ezpl.get_printer()
|
|
108
|
+
>>> printer.info("Hello!")
|
|
109
|
+
>>> printer.success("Done!")
|
|
110
|
+
>>> printer.print_json({"key": "value"})
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
# ------------------------------------------------
|
|
114
|
+
# LOGGER TYPE ALIAS
|
|
115
|
+
# ------------------------------------------------
|
|
116
|
+
Logger = EzLogger
|
|
117
|
+
"""Type alias for EzLogger (file logger handler).
|
|
118
|
+
Use this type when you want to annotate a variable that represents a logger.
|
|
119
|
+
|
|
120
|
+
Example:
|
|
121
|
+
>>> from ezpl import Ezpl, Logger
|
|
122
|
+
>>> ezpl = Ezpl()
|
|
123
|
+
>>> logger: Logger = ezpl.get_logger()
|
|
124
|
+
>>> logger.info("Logged to file")
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
# =============================================================================
|
|
128
|
+
# MODULE EXPORTS
|
|
129
|
+
# =============================================================================
|
|
130
|
+
|
|
131
|
+
__all__ = [
|
|
132
|
+
# ------------------------------------------------
|
|
133
|
+
# MAIN CLASS EXPORTS
|
|
134
|
+
# ------------------------------------------------
|
|
135
|
+
"Ezpl",
|
|
136
|
+
# ------------------------------------------------
|
|
137
|
+
# HANDLER CLASS EXPORTS
|
|
138
|
+
# ------------------------------------------------
|
|
139
|
+
"EzPrinter",
|
|
140
|
+
"EzLogger",
|
|
141
|
+
"Logger",
|
|
142
|
+
"ConsolePrinter",
|
|
143
|
+
"FileLogger",
|
|
144
|
+
"ConsolePrinterWrapper",
|
|
145
|
+
"RichWizard",
|
|
146
|
+
# ------------------------------------------------
|
|
147
|
+
# CONFIGURATION EXPORTS
|
|
148
|
+
# ------------------------------------------------
|
|
149
|
+
"ConfigurationManager",
|
|
150
|
+
# ------------------------------------------------
|
|
151
|
+
# TYPE ALIASES EXPORTS
|
|
152
|
+
# ------------------------------------------------
|
|
153
|
+
"Printer",
|
|
154
|
+
# ------------------------------------------------
|
|
155
|
+
# TYPE & PATTERN EXPORTS
|
|
156
|
+
# ------------------------------------------------
|
|
157
|
+
"LogLevel",
|
|
158
|
+
"Pattern",
|
|
159
|
+
"PATTERN_COLORS",
|
|
160
|
+
"get_pattern_color",
|
|
161
|
+
"get_pattern_color_by_name",
|
|
162
|
+
# ------------------------------------------------
|
|
163
|
+
# EXCEPTION EXPORTS
|
|
164
|
+
# ------------------------------------------------
|
|
165
|
+
"EzplError",
|
|
166
|
+
"ConfigurationError",
|
|
167
|
+
"LoggingError",
|
|
168
|
+
"ValidationError",
|
|
169
|
+
"InitializationError",
|
|
170
|
+
"FileOperationError",
|
|
171
|
+
"HandlerError",
|
|
172
|
+
# ------------------------------------------------
|
|
173
|
+
# METADATA EXPORTS
|
|
174
|
+
# ------------------------------------------------
|
|
175
|
+
"__version__",
|
|
176
|
+
"__author__",
|
|
177
|
+
"__maintainer__",
|
|
178
|
+
"__license__",
|
|
179
|
+
"__description__",
|
|
180
|
+
"__keywords__",
|
|
181
|
+
"__url__",
|
|
182
|
+
"__repository__",
|
|
183
|
+
"__python_requires__",
|
|
184
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI module for Ezpl logging framework.
|
|
3
|
+
|
|
4
|
+
This module provides the command-line interface for managing Ezpl
|
|
5
|
+
configuration, viewing logs, and performing various operations.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# =============================================================================
|
|
9
|
+
# IMPORTS
|
|
10
|
+
# =============================================================================
|
|
11
|
+
|
|
12
|
+
# ------------------------------------------------
|
|
13
|
+
# CLI ENTRY POINT
|
|
14
|
+
# ------------------------------------------------
|
|
15
|
+
from .main import cli
|
|
16
|
+
|
|
17
|
+
# =============================================================================
|
|
18
|
+
# MODULE EXPORTS
|
|
19
|
+
# =============================================================================
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
# ------------------------------------------------
|
|
23
|
+
# CLI PUBLIC API
|
|
24
|
+
# ------------------------------------------------
|
|
25
|
+
"cli",
|
|
26
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI Commands module for Ezpl logging framework.
|
|
3
|
+
|
|
4
|
+
This module contains all CLI command implementations.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# =============================================================================
|
|
8
|
+
# IMPORTS
|
|
9
|
+
# =============================================================================
|
|
10
|
+
|
|
11
|
+
# ------------------------------------------------
|
|
12
|
+
# COMMAND GROUP IMPORTS
|
|
13
|
+
# ------------------------------------------------
|
|
14
|
+
from .config import config_group
|
|
15
|
+
from .info import info_command
|
|
16
|
+
from .logs import logs_group
|
|
17
|
+
from .version import version_command
|
|
18
|
+
|
|
19
|
+
# =============================================================================
|
|
20
|
+
# MODULE EXPORTS
|
|
21
|
+
# =============================================================================
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
# ------------------------------------------------
|
|
25
|
+
# CLI COMMAND GROUPS
|
|
26
|
+
# ------------------------------------------------
|
|
27
|
+
"logs_group",
|
|
28
|
+
"config_group",
|
|
29
|
+
"version_command",
|
|
30
|
+
"info_command",
|
|
31
|
+
]
|