miu-logger 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- miu_logger/stubgen.py +0 -0
- miu_logger-0.1.2.dist-info/METADATA +151 -0
- {miu_logger-0.1.0.dist-info → miu_logger-0.1.2.dist-info}/RECORD +6 -5
- miu_logger-0.1.0.dist-info/METADATA +0 -10
- {miu_logger-0.1.0.dist-info → miu_logger-0.1.2.dist-info}/WHEEL +0 -0
- {miu_logger-0.1.0.dist-info → miu_logger-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {miu_logger-0.1.0.dist-info → miu_logger-0.1.2.dist-info}/top_level.txt +0 -0
miu_logger/stubgen.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: miu-logger
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Multiprocessing-safe domain-based logging framework with QueueListener architecture
|
|
5
|
+
Author-email: Bruno Miura <brumiura@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: logging,multiprocessing,queue,structured-logging,python-logging
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: System :: Logging
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: colorama
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
repo = LoggingRepository(config)
|
|
20
|
+
queue = repo.get_queue()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Worker processes:**
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
worker_repo = LoggingRepository(config, use_listener=False, queue=queue)
|
|
27
|
+
worker_repo.task.info("Worker started")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
All processes log safely to the same listener and files.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Debug Control
|
|
35
|
+
|
|
36
|
+
Only `.debug()` messages are conditional via `debug_enabled`:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
config.debug_enabled = False
|
|
40
|
+
repo.app.debug("Won't appear")
|
|
41
|
+
repo.app.info("Will appear")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Useful for toggling debug messages in production.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Output Structure
|
|
49
|
+
|
|
50
|
+
Logs are written in:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
logs/
|
|
54
|
+
├─ app.log # domain logs
|
|
55
|
+
├─ db.log
|
|
56
|
+
├─ redis.log
|
|
57
|
+
├─ debug.log # per-level logs
|
|
58
|
+
├─ info.log
|
|
59
|
+
├─ warning.log
|
|
60
|
+
└─ error.log
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Console output is **colorized** by level:
|
|
64
|
+
|
|
65
|
+
* DEBUG → blue
|
|
66
|
+
* INFO → green
|
|
67
|
+
* WARNING → yellow
|
|
68
|
+
* ERROR → red
|
|
69
|
+
|
|
70
|
+
Files remain clean.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Graceful Shutdown
|
|
75
|
+
|
|
76
|
+
The repository automatically shuts down on process exit and supports manual shutdown:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
repo.shutdown()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Typical Usage Example
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
repo.app.info("Service starting")
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
connect_db()
|
|
91
|
+
except Exception:
|
|
92
|
+
repo.db.exception("DB connection failed")
|
|
93
|
+
|
|
94
|
+
repo.redis.debug("Cache size: %d", cache_size)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Multiprocessing workers:**
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
def worker(queue):
|
|
101
|
+
repo = LoggingRepository(config, use_listener=False, queue=queue)
|
|
102
|
+
repo.task.info("Worker task started")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Project Structure
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
miu_logger/
|
|
111
|
+
├─ repository.py # main LoggingRepository
|
|
112
|
+
├─ listener.py # QueueListener and handler setup
|
|
113
|
+
├─ logger_factory.py # logger creation functions
|
|
114
|
+
├─ conditional.py # ConditionalLogger
|
|
115
|
+
├─ filters.py # Logger filters
|
|
116
|
+
├─ formatters.py # ColoredFormatter
|
|
117
|
+
├─ config.py # LogConfig definition
|
|
118
|
+
└─ stubgen.py # stub generator for IDE autocomplete
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## When to Use
|
|
124
|
+
|
|
125
|
+
* Services with many subsystems
|
|
126
|
+
* Multiprocessing ingestion pipelines
|
|
127
|
+
* Long-running daemons
|
|
128
|
+
* Kubernetes / systemd services
|
|
129
|
+
* Need for clear operational logs
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## When Not to Use
|
|
134
|
+
|
|
135
|
+
* Single-file scripts
|
|
136
|
+
* No multiprocessing
|
|
137
|
+
* No domain separation required
|
|
138
|
+
|
|
139
|
+
Plain `logging` is sufficient in those cases.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Author
|
|
150
|
+
|
|
151
|
+
**Bruno Miura**
|
|
@@ -6,8 +6,9 @@ miu_logger/formatters.py,sha256=JshOwo4B0mT241ElCAs6nN-_IF_SgcZwmDt7k7tibuo,675
|
|
|
6
6
|
miu_logger/listener.py,sha256=ZBw8i-f-pouPdnuw-DXEKS4ZvWIHoUtiAPMzsIomj4g,3301
|
|
7
7
|
miu_logger/logger_factory.py,sha256=MhNaP73J9RbhmmVR6simqkZRCel2g6rPImRlijYAQXI,319
|
|
8
8
|
miu_logger/repository.py,sha256=XQPkJjuYzUKNiNUmPSxRd2CygdKThB_PHIyq0WTFkic,2288
|
|
9
|
-
miu_logger
|
|
10
|
-
miu_logger-0.1.
|
|
11
|
-
miu_logger-0.1.
|
|
12
|
-
miu_logger-0.1.
|
|
13
|
-
miu_logger-0.1.
|
|
9
|
+
miu_logger/stubgen.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
miu_logger-0.1.2.dist-info/licenses/LICENSE,sha256=jLLem0QFpsFv7Lkgp7I7FeN4DIdgCKIxzklfdkkesWg,1075
|
|
11
|
+
miu_logger-0.1.2.dist-info/METADATA,sha256=vhE6IfN689deA2fA2tH71SUoGpZcndqYAcy-dk6kk5k,2915
|
|
12
|
+
miu_logger-0.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
miu_logger-0.1.2.dist-info/top_level.txt,sha256=70Nuj1YRYLMkqiRZv1pPZPhi_VystPGqm1nC3s-uHz4,11
|
|
14
|
+
miu_logger-0.1.2.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: miu-logger
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Multiprocessing-safe structured logging framework
|
|
5
|
-
Author: Bruno Miura
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Requires-Dist: colorama
|
|
10
|
-
Dynamic: license-file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|