opslogger 1.0.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.
- opslogger-1.0.0/LICENSE +21 -0
- opslogger-1.0.0/MANIFEST.in +3 -0
- opslogger-1.0.0/PKG-INFO +240 -0
- opslogger-1.0.0/README.md +188 -0
- opslogger-1.0.0/opslogger/__init__.py +26 -0
- opslogger-1.0.0/opslogger/logger.py +318 -0
- opslogger-1.0.0/opslogger.egg-info/PKG-INFO +240 -0
- opslogger-1.0.0/opslogger.egg-info/SOURCES.txt +13 -0
- opslogger-1.0.0/opslogger.egg-info/dependency_links.txt +1 -0
- opslogger-1.0.0/opslogger.egg-info/requires.txt +4 -0
- opslogger-1.0.0/opslogger.egg-info/top_level.txt +3 -0
- opslogger-1.0.0/pyproject.toml +35 -0
- opslogger-1.0.0/setup.cfg +4 -0
- opslogger-1.0.0/setup.py +48 -0
- opslogger-1.0.0/tests/test_logger.py +283 -0
opslogger-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AnantaOps
|
|
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.
|
opslogger-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opslogger
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Structured, context-aware JSON logging for Python backend services.
|
|
5
|
+
Home-page: https://github.com/AnantaOps/OpsLogger-python
|
|
6
|
+
Author: AnantaOps
|
|
7
|
+
Author-email: AnantaOps <hello@anantaops.dev>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 AnantaOps
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
Project-URL: Homepage, https://github.com/AnantaOps/OpsLogger-python
|
|
31
|
+
Project-URL: Repository, https://github.com/AnantaOps/OpsLogger-python
|
|
32
|
+
Keywords: logging,structured,json,observability,ops,backend
|
|
33
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: System :: Logging
|
|
41
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
License-File: LICENSE
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
47
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
48
|
+
Dynamic: author
|
|
49
|
+
Dynamic: home-page
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
Dynamic: requires-python
|
|
52
|
+
|
|
53
|
+
# OpsLogger (Python)
|
|
54
|
+
|
|
55
|
+
> Structured, context-aware JSON logging for Python backend services.
|
|
56
|
+
> The first Python library from **AnantaOps** — built for developers who care about observability.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Why Structured Logging Matters
|
|
61
|
+
|
|
62
|
+
Plain-text logs are a liability at scale. When your service runs in containers, Kubernetes, or any cloud environment, every log aggregator (Datadog, Loki, CloudWatch, ELK) works best with **machine-parseable, one-JSON-object-per-line** output.
|
|
63
|
+
|
|
64
|
+
OpsLogger emits exactly that:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"timestamp": "2025-03-14T10:22:01.123456+00:00",
|
|
69
|
+
"level": "ERROR",
|
|
70
|
+
"service": "PaymentService",
|
|
71
|
+
"message": "Gateway timeout",
|
|
72
|
+
"request_id": "req-abc-12345",
|
|
73
|
+
"error": "ConnectionError: dial tcp: connection refused",
|
|
74
|
+
"traceback": "Traceback (most recent call last): ...",
|
|
75
|
+
"extra": {"gateway": "stripe", "retried": true}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Benefits at a glance:
|
|
80
|
+
|
|
81
|
+
- **Filter by level** — `jq 'select(.level=="ERROR")'`
|
|
82
|
+
- **Trace a single request** — filter on `request_id`
|
|
83
|
+
- **Alert on field values** — no regex fragility
|
|
84
|
+
- **Drop into any log shipper** — Fluent Bit, Logstash, Vector, etc.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# From PyPI (once published)
|
|
92
|
+
pip install opslogger
|
|
93
|
+
|
|
94
|
+
# From source / local development
|
|
95
|
+
git clone https://github.com/AnantaOps/OpsLogger-python.git
|
|
96
|
+
cd OpsLogger-python
|
|
97
|
+
pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Requires Python 3.10+ · Zero external runtime dependencies.**
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Quick Start
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from opslogger import OpsLogger
|
|
108
|
+
|
|
109
|
+
log = OpsLogger(service_name="OrderService")
|
|
110
|
+
|
|
111
|
+
log.debug("Cache lookup", extra={"key": "user:42"})
|
|
112
|
+
log.info("Service ready", extra={"env": "prod", "port": 8080})
|
|
113
|
+
log.warning("High memory", extra={"used_mb": 920})
|
|
114
|
+
log.error("Gateway timeout", error=ConnectionError("refused"))
|
|
115
|
+
log.critical("Disk full — writes disabled")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Request ID Tracing
|
|
121
|
+
|
|
122
|
+
Attach a request ID to every log entry in a request lifecycle:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
def handle_order(request_id: str):
|
|
126
|
+
log.info("Request received", request_id=request_id, extra={"path": "/api/orders"})
|
|
127
|
+
log.info("Order created", request_id=request_id, extra={"order_id": "ord-99"})
|
|
128
|
+
log.error("Payment failed", request_id=request_id, error=exc)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Every entry in the same request shares the same `request_id`, making end-to-end tracing trivial.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Log Levels
|
|
136
|
+
|
|
137
|
+
| Method | Level | Use when |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| `debug()` | `DEBUG` | Verbose diagnostics — development only |
|
|
140
|
+
| `info()` | `INFO` | Normal operational events |
|
|
141
|
+
| `warning()` / `warn()` | `WARNING` | Recoverable, worth monitoring |
|
|
142
|
+
| `error()` | `ERROR` | Failures that need investigation |
|
|
143
|
+
| `critical()` | `CRITICAL` | Catastrophic failures |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Custom Options
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from opslogger import OpsLogger, LogLevel
|
|
151
|
+
|
|
152
|
+
# Only WARNING and above, write to a file, suppress console
|
|
153
|
+
log = OpsLogger(
|
|
154
|
+
service_name="WorkerService",
|
|
155
|
+
min_level=LogLevel.WARNING,
|
|
156
|
+
console=False,
|
|
157
|
+
log_file="/var/log/app/worker.log",
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## API Reference
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Construction
|
|
167
|
+
OpsLogger(
|
|
168
|
+
service_name: str,
|
|
169
|
+
*,
|
|
170
|
+
min_level: LogLevel = LogLevel.DEBUG, # minimum severity to emit
|
|
171
|
+
console: bool = True, # write to stderr
|
|
172
|
+
log_file: str | Path | None = None, # also write to this file
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Logging methods
|
|
176
|
+
log.debug(message, *, request_id=None, extra=None)
|
|
177
|
+
log.info(message, *, request_id=None, extra=None)
|
|
178
|
+
log.warning(message, *, request_id=None, extra=None) # also: log.warn(...)
|
|
179
|
+
log.error(message, *, error=None, request_id=None, extra=None)
|
|
180
|
+
log.critical(message, *, error=None, request_id=None, extra=None)
|
|
181
|
+
|
|
182
|
+
# Runtime control
|
|
183
|
+
log.set_min_level(level: LogLevel)
|
|
184
|
+
log.close() # release file handles
|
|
185
|
+
|
|
186
|
+
# Context manager
|
|
187
|
+
with OpsLogger("MyService", log_file="app.log") as log:
|
|
188
|
+
log.info("inside context")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Project Structure
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
OpsLogger-python/
|
|
197
|
+
├── opslogger/
|
|
198
|
+
│ ├── __init__.py ← Public API surface
|
|
199
|
+
│ └── logger.py ← Core engine
|
|
200
|
+
├── examples/
|
|
201
|
+
│ └── main.py ← Runnable usage scenarios
|
|
202
|
+
├── tests/
|
|
203
|
+
│ └── test_logger.py ← 25+ unit tests
|
|
204
|
+
├── setup.py ← pip-installable package config
|
|
205
|
+
├── LICENSE ← MIT
|
|
206
|
+
└── README.md
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Running Examples
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
python examples/main.py
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Running Tests
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Using pytest (recommended)
|
|
223
|
+
pip install pytest
|
|
224
|
+
pytest tests/ -v
|
|
225
|
+
|
|
226
|
+
# Using stdlib unittest
|
|
227
|
+
python -m unittest discover tests -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT License — Copyright (c) 2025 AnantaOps
|
|
235
|
+
|
|
236
|
+
See [LICENSE](./LICENSE) for the full text.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
Built with ❤️ by [AnantaOps](https://github.com/AnantaOps)
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# OpsLogger (Python)
|
|
2
|
+
|
|
3
|
+
> Structured, context-aware JSON logging for Python backend services.
|
|
4
|
+
> The first Python library from **AnantaOps** — built for developers who care about observability.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Why Structured Logging Matters
|
|
9
|
+
|
|
10
|
+
Plain-text logs are a liability at scale. When your service runs in containers, Kubernetes, or any cloud environment, every log aggregator (Datadog, Loki, CloudWatch, ELK) works best with **machine-parseable, one-JSON-object-per-line** output.
|
|
11
|
+
|
|
12
|
+
OpsLogger emits exactly that:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"timestamp": "2025-03-14T10:22:01.123456+00:00",
|
|
17
|
+
"level": "ERROR",
|
|
18
|
+
"service": "PaymentService",
|
|
19
|
+
"message": "Gateway timeout",
|
|
20
|
+
"request_id": "req-abc-12345",
|
|
21
|
+
"error": "ConnectionError: dial tcp: connection refused",
|
|
22
|
+
"traceback": "Traceback (most recent call last): ...",
|
|
23
|
+
"extra": {"gateway": "stripe", "retried": true}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Benefits at a glance:
|
|
28
|
+
|
|
29
|
+
- **Filter by level** — `jq 'select(.level=="ERROR")'`
|
|
30
|
+
- **Trace a single request** — filter on `request_id`
|
|
31
|
+
- **Alert on field values** — no regex fragility
|
|
32
|
+
- **Drop into any log shipper** — Fluent Bit, Logstash, Vector, etc.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# From PyPI (once published)
|
|
40
|
+
pip install opslogger
|
|
41
|
+
|
|
42
|
+
# From source / local development
|
|
43
|
+
git clone https://github.com/AnantaOps/OpsLogger-python.git
|
|
44
|
+
cd OpsLogger-python
|
|
45
|
+
pip install -e .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Requires Python 3.10+ · Zero external runtime dependencies.**
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from opslogger import OpsLogger
|
|
56
|
+
|
|
57
|
+
log = OpsLogger(service_name="OrderService")
|
|
58
|
+
|
|
59
|
+
log.debug("Cache lookup", extra={"key": "user:42"})
|
|
60
|
+
log.info("Service ready", extra={"env": "prod", "port": 8080})
|
|
61
|
+
log.warning("High memory", extra={"used_mb": 920})
|
|
62
|
+
log.error("Gateway timeout", error=ConnectionError("refused"))
|
|
63
|
+
log.critical("Disk full — writes disabled")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Request ID Tracing
|
|
69
|
+
|
|
70
|
+
Attach a request ID to every log entry in a request lifecycle:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
def handle_order(request_id: str):
|
|
74
|
+
log.info("Request received", request_id=request_id, extra={"path": "/api/orders"})
|
|
75
|
+
log.info("Order created", request_id=request_id, extra={"order_id": "ord-99"})
|
|
76
|
+
log.error("Payment failed", request_id=request_id, error=exc)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Every entry in the same request shares the same `request_id`, making end-to-end tracing trivial.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Log Levels
|
|
84
|
+
|
|
85
|
+
| Method | Level | Use when |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `debug()` | `DEBUG` | Verbose diagnostics — development only |
|
|
88
|
+
| `info()` | `INFO` | Normal operational events |
|
|
89
|
+
| `warning()` / `warn()` | `WARNING` | Recoverable, worth monitoring |
|
|
90
|
+
| `error()` | `ERROR` | Failures that need investigation |
|
|
91
|
+
| `critical()` | `CRITICAL` | Catastrophic failures |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Custom Options
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from opslogger import OpsLogger, LogLevel
|
|
99
|
+
|
|
100
|
+
# Only WARNING and above, write to a file, suppress console
|
|
101
|
+
log = OpsLogger(
|
|
102
|
+
service_name="WorkerService",
|
|
103
|
+
min_level=LogLevel.WARNING,
|
|
104
|
+
console=False,
|
|
105
|
+
log_file="/var/log/app/worker.log",
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
# Construction
|
|
115
|
+
OpsLogger(
|
|
116
|
+
service_name: str,
|
|
117
|
+
*,
|
|
118
|
+
min_level: LogLevel = LogLevel.DEBUG, # minimum severity to emit
|
|
119
|
+
console: bool = True, # write to stderr
|
|
120
|
+
log_file: str | Path | None = None, # also write to this file
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Logging methods
|
|
124
|
+
log.debug(message, *, request_id=None, extra=None)
|
|
125
|
+
log.info(message, *, request_id=None, extra=None)
|
|
126
|
+
log.warning(message, *, request_id=None, extra=None) # also: log.warn(...)
|
|
127
|
+
log.error(message, *, error=None, request_id=None, extra=None)
|
|
128
|
+
log.critical(message, *, error=None, request_id=None, extra=None)
|
|
129
|
+
|
|
130
|
+
# Runtime control
|
|
131
|
+
log.set_min_level(level: LogLevel)
|
|
132
|
+
log.close() # release file handles
|
|
133
|
+
|
|
134
|
+
# Context manager
|
|
135
|
+
with OpsLogger("MyService", log_file="app.log") as log:
|
|
136
|
+
log.info("inside context")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Project Structure
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
OpsLogger-python/
|
|
145
|
+
├── opslogger/
|
|
146
|
+
│ ├── __init__.py ← Public API surface
|
|
147
|
+
│ └── logger.py ← Core engine
|
|
148
|
+
├── examples/
|
|
149
|
+
│ └── main.py ← Runnable usage scenarios
|
|
150
|
+
├── tests/
|
|
151
|
+
│ └── test_logger.py ← 25+ unit tests
|
|
152
|
+
├── setup.py ← pip-installable package config
|
|
153
|
+
├── LICENSE ← MIT
|
|
154
|
+
└── README.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Running Examples
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
python examples/main.py
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Running Tests
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Using pytest (recommended)
|
|
171
|
+
pip install pytest
|
|
172
|
+
pytest tests/ -v
|
|
173
|
+
|
|
174
|
+
# Using stdlib unittest
|
|
175
|
+
python -m unittest discover tests -v
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
MIT License — Copyright (c) 2025 AnantaOps
|
|
183
|
+
|
|
184
|
+
See [LICENSE](./LICENSE) for the full text.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
Built with ❤️ by [AnantaOps](https://github.com/AnantaOps)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OpsLogger — Structured, context-aware JSON logging for Python backend services.
|
|
3
|
+
|
|
4
|
+
A lightweight, zero-dependency logging library built for developers and companies
|
|
5
|
+
who need clean, machine-readable logs that integrate seamlessly with modern
|
|
6
|
+
observability stacks (Datadog, Loki, CloudWatch, ELK, etc.).
|
|
7
|
+
|
|
8
|
+
Basic usage::
|
|
9
|
+
|
|
10
|
+
from opslogger import OpsLogger
|
|
11
|
+
|
|
12
|
+
log = OpsLogger(service_name="OrderService")
|
|
13
|
+
log.info("Service started", extra={"env": "prod", "port": 8080})
|
|
14
|
+
log.error("Unexpected failure", error=Exception("timeout"))
|
|
15
|
+
|
|
16
|
+
With request ID tracing::
|
|
17
|
+
|
|
18
|
+
log.info("Request received", request_id="req-abc-123", extra={"method": "POST"})
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from opslogger.logger import OpsLogger, LogLevel
|
|
22
|
+
|
|
23
|
+
__all__ = ["OpsLogger", "LogLevel"]
|
|
24
|
+
__version__ = "1.0.0"
|
|
25
|
+
__author__ = "AnantaOps"
|
|
26
|
+
__license__ = "MIT"
|