devlogs 1.1.1__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.
- devlogs-1.1.1/LICENSE +21 -0
- devlogs-1.1.1/MANIFEST.in +1 -0
- devlogs-1.1.1/PKG-INFO +212 -0
- devlogs-1.1.1/README.md +169 -0
- devlogs-1.1.1/pyproject.toml +47 -0
- devlogs-1.1.1/setup.cfg +4 -0
- devlogs-1.1.1/src/devlogs/__init__.py +1 -0
- devlogs-1.1.1/src/devlogs/__main__.py +5 -0
- devlogs-1.1.1/src/devlogs/cli.py +987 -0
- devlogs-1.1.1/src/devlogs/config.py +181 -0
- devlogs-1.1.1/src/devlogs/context.py +41 -0
- devlogs-1.1.1/src/devlogs/demo.py +228 -0
- devlogs-1.1.1/src/devlogs/formatting.py +34 -0
- devlogs-1.1.1/src/devlogs/handler.py +167 -0
- devlogs-1.1.1/src/devlogs/jenkins/__init__.py +1 -0
- devlogs-1.1.1/src/devlogs/jenkins/cli.py +239 -0
- devlogs-1.1.1/src/devlogs/jenkins/core.py +619 -0
- devlogs-1.1.1/src/devlogs/levels.py +12 -0
- devlogs-1.1.1/src/devlogs/mcp/__init__.py +1 -0
- devlogs-1.1.1/src/devlogs/mcp/server.py +795 -0
- devlogs-1.1.1/src/devlogs/opensearch/__init__.py +1 -0
- devlogs-1.1.1/src/devlogs/opensearch/client.py +265 -0
- devlogs-1.1.1/src/devlogs/opensearch/indexing.py +5 -0
- devlogs-1.1.1/src/devlogs/opensearch/mappings.py +47 -0
- devlogs-1.1.1/src/devlogs/opensearch/queries.py +699 -0
- devlogs-1.1.1/src/devlogs/retention.py +186 -0
- devlogs-1.1.1/src/devlogs/scrub.py +64 -0
- devlogs-1.1.1/src/devlogs/time_utils.py +37 -0
- devlogs-1.1.1/src/devlogs/web/__init__.py +1 -0
- devlogs-1.1.1/src/devlogs/web/server.py +79 -0
- devlogs-1.1.1/src/devlogs/web/static/devlogs.css +342 -0
- devlogs-1.1.1/src/devlogs/web/static/devlogs.js +333 -0
- devlogs-1.1.1/src/devlogs/web/static/index.html +68 -0
- devlogs-1.1.1/src/devlogs/wrapper.py +30 -0
- devlogs-1.1.1/src/devlogs.egg-info/PKG-INFO +212 -0
- devlogs-1.1.1/src/devlogs.egg-info/SOURCES.txt +52 -0
- devlogs-1.1.1/src/devlogs.egg-info/dependency_links.txt +1 -0
- devlogs-1.1.1/src/devlogs.egg-info/entry_points.txt +3 -0
- devlogs-1.1.1/src/devlogs.egg-info/requires.txt +12 -0
- devlogs-1.1.1/src/devlogs.egg-info/top_level.txt +1 -0
- devlogs-1.1.1/tests/test_cli.py +629 -0
- devlogs-1.1.1/tests/test_config.py +293 -0
- devlogs-1.1.1/tests/test_context.py +81 -0
- devlogs-1.1.1/tests/test_formatting.py +55 -0
- devlogs-1.1.1/tests/test_handler.py +389 -0
- devlogs-1.1.1/tests/test_indexing.py +185 -0
- devlogs-1.1.1/tests/test_levels.py +89 -0
- devlogs-1.1.1/tests/test_mcp_server.py +374 -0
- devlogs-1.1.1/tests/test_opensearch_client.py +408 -0
- devlogs-1.1.1/tests/test_opensearch_queries.py +223 -0
- devlogs-1.1.1/tests/test_retention.py +293 -0
- devlogs-1.1.1/tests/test_scrub.py +62 -0
- devlogs-1.1.1/tests/test_time_utils.py +18 -0
- devlogs-1.1.1/tests/test_web.py +82 -0
devlogs-1.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dandriscoll
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include src/devlogs/web/static *.html *.css *.js
|
devlogs-1.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devlogs
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: Developer-focused logging library for Python with OpenSearch integration.
|
|
5
|
+
Author-email: Dan Driscoll <dan@thedandriscoll.org>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 dandriscoll
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: opensearch-py>=2.4.0
|
|
32
|
+
Requires-Dist: click>=8.1.0
|
|
33
|
+
Requires-Dist: typer>=0.9.0
|
|
34
|
+
Requires-Dist: fastapi>=0.110.0
|
|
35
|
+
Requires-Dist: uvicorn>=0.24.0
|
|
36
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
37
|
+
Requires-Dist: mcp>=1.0.0
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: httpx>=0.26.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# devlogs
|
|
45
|
+
|
|
46
|
+
A developer-focused logging library for Python based on OpenSearch.
|
|
47
|
+
|
|
48
|
+
## Step 1: Get OpenSearch running
|
|
49
|
+
|
|
50
|
+
If you don't have OpenSearch running and you want to stand one up:
|
|
51
|
+
1. Install Docker (and Docker Compose) for your OS.
|
|
52
|
+
2. Copy `docker-compose.example.yaml` to `docker-compose.yaml`.
|
|
53
|
+
3. Change the OpenSearch password in the copied file.
|
|
54
|
+
4. Start OpenSearch:
|
|
55
|
+
```sh
|
|
56
|
+
docker compose up -d
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Step 2: Copy/paste these instructions into your coding agent
|
|
60
|
+
|
|
61
|
+
> Please do the following in this project:
|
|
62
|
+
> 1. Install `devlogs` as a dev dependency (`pip install devlogs` or add it to `requirements-dev.txt`/`pyproject.toml` optional dependencies).
|
|
63
|
+
> 2. Add `DEVLOGS_OPENSEARCH_HOST`, `DEVLOGS_OPENSEARCH_PORT`, `DEVLOGS_OPENSEARCH_USER`, `DEVLOGS_OPENSEARCH_PASS`, and `DEVLOGS_INDEX` to the project `.env` file (or equivalent config). Defaults are `localhost`, `9200`, `admin`, and `devlogs-<projectname>`.
|
|
64
|
+
> 3. Add devlogs hooks at the beginning of the application (main entrypoint/startup module), wrapped in an environment check so it only runs in development:
|
|
65
|
+
> ```python
|
|
66
|
+
> import os
|
|
67
|
+
> if os.getenv("ENVIRONMENT") != "production":
|
|
68
|
+
> from devlogs.handler import OpenSearchHandler
|
|
69
|
+
> handler = OpenSearchHandler(level=logging.INFO)
|
|
70
|
+
> logging.getLogger().addHandler(handler)
|
|
71
|
+
> logging.getLogger().setLevel(logging.INFO)
|
|
72
|
+
> ```
|
|
73
|
+
> 4. Run `devlogs init` (inside the virtualenv if one is set up) and verify the index is healthy.
|
|
74
|
+
> 5. Ask the user if they want MCP set up; if yes, state which agent you are (`copilot`, `claude`, or `codex`) and run `devlogs initmcp <agent>`.
|
|
75
|
+
|
|
76
|
+
## Step 3: Use devlogs
|
|
77
|
+
|
|
78
|
+
1. Run `devlogs initmcp <agent>` to set up the MCP server.
|
|
79
|
+
2. Then run `devlogs tail` to see the last logs, or `devlogs tail -f` to follow along
|
|
80
|
+
3. Finally, ask your agent to query devlogs for errors. Watch it solve problems on its own!
|
|
81
|
+
|
|
82
|
+
## If you want to install it by hand
|
|
83
|
+
|
|
84
|
+
1. **Install devlogs:**
|
|
85
|
+
```sh
|
|
86
|
+
pip install devlogs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. **Start OpenSearch:**
|
|
90
|
+
```sh
|
|
91
|
+
docker-compose up -d opensearch
|
|
92
|
+
```
|
|
93
|
+
Or point `DEVLOGS_OPENSEARCH_*` at an existing cluster.
|
|
94
|
+
|
|
95
|
+
3. **Initialize indices/templates:**
|
|
96
|
+
```sh
|
|
97
|
+
devlogs init
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
4. **Use in Python code (development only):**
|
|
101
|
+
```python
|
|
102
|
+
import os
|
|
103
|
+
import logging
|
|
104
|
+
|
|
105
|
+
# Only enable devlogs in development
|
|
106
|
+
if os.getenv("ENVIRONMENT") != "production":
|
|
107
|
+
from devlogs.handler import OpenSearchHandler
|
|
108
|
+
logging.getLogger().addHandler(OpenSearchHandler(level=logging.DEBUG))
|
|
109
|
+
|
|
110
|
+
logging.getLogger().setLevel(logging.DEBUG)
|
|
111
|
+
logging.info("Hello from devlogs!")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
5. **Tail logs from CLI:**
|
|
115
|
+
```sh
|
|
116
|
+
devlogs tail --area web --follow
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
6. **Search logs from CLI:**
|
|
120
|
+
```sh
|
|
121
|
+
devlogs search --q "error" --area web
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
7. **Run the web UI:**
|
|
125
|
+
```sh
|
|
126
|
+
uvicorn devlogs.web.server:app --port 8088
|
|
127
|
+
# Then open http://localhost:8088/ui/
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## MCP Agent Setup
|
|
131
|
+
|
|
132
|
+
If you want MCP set up, identify your agent type and run the matching command from your project root:
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
devlogs initmcp copilot
|
|
136
|
+
devlogs initmcp claude
|
|
137
|
+
devlogs initmcp codex
|
|
138
|
+
devlogs initmcp all
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This writes MCP config files in the standard locations:
|
|
142
|
+
- Claude: `.mcp.json`
|
|
143
|
+
- Copilot (VS Code): `.vscode/mcp.json`
|
|
144
|
+
- Codex: `~/.codex/config.toml`
|
|
145
|
+
|
|
146
|
+
## Features
|
|
147
|
+
|
|
148
|
+
- Standard `logging.Handler` for OpenSearch
|
|
149
|
+
- Context manager for operation_id/area
|
|
150
|
+
- Structured feature pairs on log entries (`extra={"features": {...}}`)
|
|
151
|
+
- CLI and Linux shell wrapper
|
|
152
|
+
- Minimal embeddable web UI
|
|
153
|
+
- Robust tests (pytest)
|
|
154
|
+
|
|
155
|
+
## Jenkins Integration
|
|
156
|
+
|
|
157
|
+
Stream Jenkins build logs to OpenSearch. If devlogs is a dev dependency in your repo:
|
|
158
|
+
|
|
159
|
+
```groovy
|
|
160
|
+
pipeline {
|
|
161
|
+
agent any
|
|
162
|
+
environment {
|
|
163
|
+
DEVLOGS_OPENSEARCH_URL = credentials('devlogs-opensearch-url')
|
|
164
|
+
}
|
|
165
|
+
stages {
|
|
166
|
+
stage('Build') {
|
|
167
|
+
steps {
|
|
168
|
+
sh 'devlogs jenkins attach --background'
|
|
169
|
+
sh 'make build'
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
post {
|
|
174
|
+
always { sh 'devlogs jenkins stop || true' }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
See [HOWTO-JENKINS.md](HOWTO-JENKINS.md) for full documentation.
|
|
180
|
+
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
Environment variables:
|
|
184
|
+
- OpenSearch connection: `DEVLOGS_OPENSEARCH_HOST`, `DEVLOGS_OPENSEARCH_PORT`, `DEVLOGS_OPENSEARCH_USER`, `DEVLOGS_OPENSEARCH_PASS`
|
|
185
|
+
- OpenSearch URL shortcut: `DEVLOGS_OPENSEARCH_URL` (e.g., `https://user:pass@host:9200`)
|
|
186
|
+
- SSL/TLS: `DEVLOGS_OPENSEARCH_VERIFY_CERTS`, `DEVLOGS_OPENSEARCH_CA_CERT`
|
|
187
|
+
- Index: `DEVLOGS_INDEX`
|
|
188
|
+
- Retention (supports duration strings like `24h`, `7d`): `DEVLOGS_RETENTION_DEBUG`, `DEVLOGS_RETENTION_INFO`, `DEVLOGS_RETENTION_WARNING`
|
|
189
|
+
|
|
190
|
+
See [.env.example](.env.example) for a complete configuration template.
|
|
191
|
+
|
|
192
|
+
## Production Deployment
|
|
193
|
+
|
|
194
|
+
Devlogs is a development tool. The examples above show how to conditionally enable it using an environment check. You can also make it an optional dependency:
|
|
195
|
+
|
|
196
|
+
```toml
|
|
197
|
+
# pyproject.toml
|
|
198
|
+
[project.optional-dependencies]
|
|
199
|
+
dev = ["devlogs>=1.1.0"]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Install with `pip install ".[dev]"` in development, `pip install .` in production.
|
|
203
|
+
|
|
204
|
+
## Project Structure
|
|
205
|
+
|
|
206
|
+
- `src/devlogs/` - Python library, CLI, MCP server, and web UI
|
|
207
|
+
- `devlogs` - Shell wrapper for local development
|
|
208
|
+
- `tests/` - Pytest-based tests
|
|
209
|
+
|
|
210
|
+
## See Also
|
|
211
|
+
|
|
212
|
+
- `PROMPT.md` for full requirements
|
devlogs-1.1.1/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# devlogs
|
|
2
|
+
|
|
3
|
+
A developer-focused logging library for Python based on OpenSearch.
|
|
4
|
+
|
|
5
|
+
## Step 1: Get OpenSearch running
|
|
6
|
+
|
|
7
|
+
If you don't have OpenSearch running and you want to stand one up:
|
|
8
|
+
1. Install Docker (and Docker Compose) for your OS.
|
|
9
|
+
2. Copy `docker-compose.example.yaml` to `docker-compose.yaml`.
|
|
10
|
+
3. Change the OpenSearch password in the copied file.
|
|
11
|
+
4. Start OpenSearch:
|
|
12
|
+
```sh
|
|
13
|
+
docker compose up -d
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Step 2: Copy/paste these instructions into your coding agent
|
|
17
|
+
|
|
18
|
+
> Please do the following in this project:
|
|
19
|
+
> 1. Install `devlogs` as a dev dependency (`pip install devlogs` or add it to `requirements-dev.txt`/`pyproject.toml` optional dependencies).
|
|
20
|
+
> 2. Add `DEVLOGS_OPENSEARCH_HOST`, `DEVLOGS_OPENSEARCH_PORT`, `DEVLOGS_OPENSEARCH_USER`, `DEVLOGS_OPENSEARCH_PASS`, and `DEVLOGS_INDEX` to the project `.env` file (or equivalent config). Defaults are `localhost`, `9200`, `admin`, and `devlogs-<projectname>`.
|
|
21
|
+
> 3. Add devlogs hooks at the beginning of the application (main entrypoint/startup module), wrapped in an environment check so it only runs in development:
|
|
22
|
+
> ```python
|
|
23
|
+
> import os
|
|
24
|
+
> if os.getenv("ENVIRONMENT") != "production":
|
|
25
|
+
> from devlogs.handler import OpenSearchHandler
|
|
26
|
+
> handler = OpenSearchHandler(level=logging.INFO)
|
|
27
|
+
> logging.getLogger().addHandler(handler)
|
|
28
|
+
> logging.getLogger().setLevel(logging.INFO)
|
|
29
|
+
> ```
|
|
30
|
+
> 4. Run `devlogs init` (inside the virtualenv if one is set up) and verify the index is healthy.
|
|
31
|
+
> 5. Ask the user if they want MCP set up; if yes, state which agent you are (`copilot`, `claude`, or `codex`) and run `devlogs initmcp <agent>`.
|
|
32
|
+
|
|
33
|
+
## Step 3: Use devlogs
|
|
34
|
+
|
|
35
|
+
1. Run `devlogs initmcp <agent>` to set up the MCP server.
|
|
36
|
+
2. Then run `devlogs tail` to see the last logs, or `devlogs tail -f` to follow along
|
|
37
|
+
3. Finally, ask your agent to query devlogs for errors. Watch it solve problems on its own!
|
|
38
|
+
|
|
39
|
+
## If you want to install it by hand
|
|
40
|
+
|
|
41
|
+
1. **Install devlogs:**
|
|
42
|
+
```sh
|
|
43
|
+
pip install devlogs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. **Start OpenSearch:**
|
|
47
|
+
```sh
|
|
48
|
+
docker-compose up -d opensearch
|
|
49
|
+
```
|
|
50
|
+
Or point `DEVLOGS_OPENSEARCH_*` at an existing cluster.
|
|
51
|
+
|
|
52
|
+
3. **Initialize indices/templates:**
|
|
53
|
+
```sh
|
|
54
|
+
devlogs init
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
4. **Use in Python code (development only):**
|
|
58
|
+
```python
|
|
59
|
+
import os
|
|
60
|
+
import logging
|
|
61
|
+
|
|
62
|
+
# Only enable devlogs in development
|
|
63
|
+
if os.getenv("ENVIRONMENT") != "production":
|
|
64
|
+
from devlogs.handler import OpenSearchHandler
|
|
65
|
+
logging.getLogger().addHandler(OpenSearchHandler(level=logging.DEBUG))
|
|
66
|
+
|
|
67
|
+
logging.getLogger().setLevel(logging.DEBUG)
|
|
68
|
+
logging.info("Hello from devlogs!")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
5. **Tail logs from CLI:**
|
|
72
|
+
```sh
|
|
73
|
+
devlogs tail --area web --follow
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
6. **Search logs from CLI:**
|
|
77
|
+
```sh
|
|
78
|
+
devlogs search --q "error" --area web
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
7. **Run the web UI:**
|
|
82
|
+
```sh
|
|
83
|
+
uvicorn devlogs.web.server:app --port 8088
|
|
84
|
+
# Then open http://localhost:8088/ui/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## MCP Agent Setup
|
|
88
|
+
|
|
89
|
+
If you want MCP set up, identify your agent type and run the matching command from your project root:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
devlogs initmcp copilot
|
|
93
|
+
devlogs initmcp claude
|
|
94
|
+
devlogs initmcp codex
|
|
95
|
+
devlogs initmcp all
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This writes MCP config files in the standard locations:
|
|
99
|
+
- Claude: `.mcp.json`
|
|
100
|
+
- Copilot (VS Code): `.vscode/mcp.json`
|
|
101
|
+
- Codex: `~/.codex/config.toml`
|
|
102
|
+
|
|
103
|
+
## Features
|
|
104
|
+
|
|
105
|
+
- Standard `logging.Handler` for OpenSearch
|
|
106
|
+
- Context manager for operation_id/area
|
|
107
|
+
- Structured feature pairs on log entries (`extra={"features": {...}}`)
|
|
108
|
+
- CLI and Linux shell wrapper
|
|
109
|
+
- Minimal embeddable web UI
|
|
110
|
+
- Robust tests (pytest)
|
|
111
|
+
|
|
112
|
+
## Jenkins Integration
|
|
113
|
+
|
|
114
|
+
Stream Jenkins build logs to OpenSearch. If devlogs is a dev dependency in your repo:
|
|
115
|
+
|
|
116
|
+
```groovy
|
|
117
|
+
pipeline {
|
|
118
|
+
agent any
|
|
119
|
+
environment {
|
|
120
|
+
DEVLOGS_OPENSEARCH_URL = credentials('devlogs-opensearch-url')
|
|
121
|
+
}
|
|
122
|
+
stages {
|
|
123
|
+
stage('Build') {
|
|
124
|
+
steps {
|
|
125
|
+
sh 'devlogs jenkins attach --background'
|
|
126
|
+
sh 'make build'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
post {
|
|
131
|
+
always { sh 'devlogs jenkins stop || true' }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
See [HOWTO-JENKINS.md](HOWTO-JENKINS.md) for full documentation.
|
|
137
|
+
|
|
138
|
+
## Configuration
|
|
139
|
+
|
|
140
|
+
Environment variables:
|
|
141
|
+
- OpenSearch connection: `DEVLOGS_OPENSEARCH_HOST`, `DEVLOGS_OPENSEARCH_PORT`, `DEVLOGS_OPENSEARCH_USER`, `DEVLOGS_OPENSEARCH_PASS`
|
|
142
|
+
- OpenSearch URL shortcut: `DEVLOGS_OPENSEARCH_URL` (e.g., `https://user:pass@host:9200`)
|
|
143
|
+
- SSL/TLS: `DEVLOGS_OPENSEARCH_VERIFY_CERTS`, `DEVLOGS_OPENSEARCH_CA_CERT`
|
|
144
|
+
- Index: `DEVLOGS_INDEX`
|
|
145
|
+
- Retention (supports duration strings like `24h`, `7d`): `DEVLOGS_RETENTION_DEBUG`, `DEVLOGS_RETENTION_INFO`, `DEVLOGS_RETENTION_WARNING`
|
|
146
|
+
|
|
147
|
+
See [.env.example](.env.example) for a complete configuration template.
|
|
148
|
+
|
|
149
|
+
## Production Deployment
|
|
150
|
+
|
|
151
|
+
Devlogs is a development tool. The examples above show how to conditionally enable it using an environment check. You can also make it an optional dependency:
|
|
152
|
+
|
|
153
|
+
```toml
|
|
154
|
+
# pyproject.toml
|
|
155
|
+
[project.optional-dependencies]
|
|
156
|
+
dev = ["devlogs>=1.1.0"]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Install with `pip install ".[dev]"` in development, `pip install .` in production.
|
|
160
|
+
|
|
161
|
+
## Project Structure
|
|
162
|
+
|
|
163
|
+
- `src/devlogs/` - Python library, CLI, MCP server, and web UI
|
|
164
|
+
- `devlogs` - Shell wrapper for local development
|
|
165
|
+
- `tests/` - Pytest-based tests
|
|
166
|
+
|
|
167
|
+
## See Also
|
|
168
|
+
|
|
169
|
+
- `PROMPT.md` for full requirements
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "devlogs"
|
|
7
|
+
version = "1.1.1"
|
|
8
|
+
description = "Developer-focused logging library for Python with OpenSearch integration."
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = {file = "LICENSE"}
|
|
12
|
+
authors = [{name = "Dan Driscoll", email = "dan@thedandriscoll.org"}]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"opensearch-py>=2.4.0",
|
|
15
|
+
"click>=8.1.0",
|
|
16
|
+
"typer>=0.9.0",
|
|
17
|
+
"fastapi>=0.110.0",
|
|
18
|
+
"uvicorn>=0.24.0",
|
|
19
|
+
"python-dotenv>=1.0.0",
|
|
20
|
+
"mcp>=1.0.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
dev = [
|
|
25
|
+
"httpx>=0.26.0",
|
|
26
|
+
"pytest>=8.0.0",
|
|
27
|
+
"pytest-asyncio>=0.23.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
devlogs = "devlogs.wrapper:main"
|
|
32
|
+
devlogs-cli = "devlogs.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
package-dir = {"" = "src"}
|
|
36
|
+
include-package-data = true
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
"devlogs.web" = ["static/*.html", "static/*.css", "static/*.js"]
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
markers = [
|
|
46
|
+
"integration: marks tests as integration (deselect with '-m \"not integration\"')",
|
|
47
|
+
]
|
devlogs-1.1.1/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# devlogs package
|