swarmauri_middleware_logging 0.8.0.dev4__tar.gz → 0.8.0.dev32__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.
@@ -1,8 +1,10 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: swarmauri_middleware_logging
3
- Version: 0.8.0.dev4
3
+ Version: 0.8.0.dev32
4
4
  Summary: Logging middleware for Swarmauri
5
- License: Apache-2.0
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,sdk,standards,middleware,logging
6
8
  Author: Jacob Stewart
7
9
  Author-email: jacob@swarmauri.com
8
10
  Requires-Python: >=3.10,<3.13
@@ -13,13 +15,16 @@ Classifier: Programming Language :: Python :: 3.11
13
15
  Classifier: Programming Language :: Python :: 3.12
14
16
  Classifier: Programming Language :: Python :: 3.13
15
17
  Classifier: Development Status :: 3 - Alpha
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
16
21
  Requires-Dist: fastapi
17
22
  Requires-Dist: swarmauri_base
18
23
  Requires-Dist: swarmauri_core
19
24
  Requires-Dist: swarmauri_standard
20
25
  Description-Content-Type: text/markdown
21
26
 
22
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
27
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
23
28
 
24
29
  <p align="center">
25
30
  <a href="https://pypi.org/project/swarmauri_middleware_logging/">
@@ -43,15 +48,64 @@ Description-Content-Type: text/markdown
43
48
 
44
49
  # Swarmauri Middleware Logging
45
50
 
46
- Middleware for logging requests and responses in Swarmauri applications.
51
+ HTTP middleware for logging requests and responses in Swarmauri and FastAPI applications.
52
+
53
+ ## Features
54
+
55
+ - Logs the HTTP method and path for each incoming request.
56
+ - Captures request headers and attempts to parse JSON bodies for inspection.
57
+ - Emits a warning when the request body cannot be decoded as JSON.
58
+ - Measures total processing time and records the response status code.
47
59
 
48
60
  ## Installation
49
61
 
62
+ Install the package with your preferred Python packaging tool:
63
+
50
64
  ```bash
51
65
  pip install swarmauri_middleware_logging
52
66
  ```
53
67
 
68
+ ```bash
69
+ poetry add swarmauri_middleware_logging
70
+ ```
71
+
72
+ ```bash
73
+ uv pip install swarmauri_middleware_logging
74
+ ```
75
+
76
+ ```bash
77
+ uv add swarmauri_middleware_logging
78
+ ```
79
+
80
+ ## Example
81
+
82
+ ```python
83
+ from fastapi import FastAPI, Request
84
+ from fastapi.testclient import TestClient
85
+
86
+ from swarmauri_middleware_logging import LoggingMiddleware
87
+
88
+ app = FastAPI()
89
+ logging_middleware = LoggingMiddleware()
90
+
91
+
92
+ @app.middleware("http")
93
+ async def log_requests(request: Request, call_next):
94
+ return await logging_middleware.dispatch(request, call_next)
95
+
96
+
97
+ @app.post("/echo")
98
+ async def echo(payload: dict):
99
+ return payload
100
+
101
+
102
+ client = TestClient(app)
103
+ print(client.post("/echo", json={"message": "hello"}).json())
104
+ ```
105
+
106
+ Running the example prints the echoed payload and produces INFO-level log entries for the request and response lifecycle.
107
+
54
108
  ## Want to help?
55
109
 
56
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
110
+ If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) that will help you get started.
57
111
 
@@ -0,0 +1,84 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri_middleware_logging/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri_middleware_logging" alt="PyPI - Downloads"/>
6
+ </a>
7
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_logging/">
8
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_logging.svg"/>
9
+ </a>
10
+ <a href="https://pypi.org/project/swarmauri_middleware_logging/">
11
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_middleware_logging" alt="PyPI - Python Version"/>
12
+ </a>
13
+ <a href="https://pypi.org/project/swarmauri_middleware_logging/">
14
+ <img src="https://img.shields.io/pypi/l/swarmauri_middleware_logging" alt="PyPI - License"/>
15
+ </a>
16
+ <a href="https://pypi.org/project/swarmauri_middleware_logging/">
17
+ <img src="https://img.shields.io/pypi/v/swarmauri_middleware_logging?label=swarmauri_middleware_logging&color=green" alt="PyPI - swarmauri_middleware_logging"/>
18
+ </a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ # Swarmauri Middleware Logging
24
+
25
+ HTTP middleware for logging requests and responses in Swarmauri and FastAPI applications.
26
+
27
+ ## Features
28
+
29
+ - Logs the HTTP method and path for each incoming request.
30
+ - Captures request headers and attempts to parse JSON bodies for inspection.
31
+ - Emits a warning when the request body cannot be decoded as JSON.
32
+ - Measures total processing time and records the response status code.
33
+
34
+ ## Installation
35
+
36
+ Install the package with your preferred Python packaging tool:
37
+
38
+ ```bash
39
+ pip install swarmauri_middleware_logging
40
+ ```
41
+
42
+ ```bash
43
+ poetry add swarmauri_middleware_logging
44
+ ```
45
+
46
+ ```bash
47
+ uv pip install swarmauri_middleware_logging
48
+ ```
49
+
50
+ ```bash
51
+ uv add swarmauri_middleware_logging
52
+ ```
53
+
54
+ ## Example
55
+
56
+ ```python
57
+ from fastapi import FastAPI, Request
58
+ from fastapi.testclient import TestClient
59
+
60
+ from swarmauri_middleware_logging import LoggingMiddleware
61
+
62
+ app = FastAPI()
63
+ logging_middleware = LoggingMiddleware()
64
+
65
+
66
+ @app.middleware("http")
67
+ async def log_requests(request: Request, call_next):
68
+ return await logging_middleware.dispatch(request, call_next)
69
+
70
+
71
+ @app.post("/echo")
72
+ async def echo(payload: dict):
73
+ return payload
74
+
75
+
76
+ client = TestClient(app)
77
+ print(client.post("/echo", json={"message": "hello"}).json())
78
+ ```
79
+
80
+ Running the example prints the echoed payload and produces INFO-level log entries for the request and response lifecycle.
81
+
82
+ ## Want to help?
83
+
84
+ If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) that will help you get started.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_middleware_logging"
3
- version = "0.8.0.dev4"
3
+ version = "0.8.0.dev32"
4
4
  description = "Logging middleware for Swarmauri"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
@@ -13,7 +13,10 @@ classifiers = [
13
13
  "Programming Language :: Python :: 3.11",
14
14
  "Programming Language :: Python :: 3.12",
15
15
  "Programming Language :: Python :: 3.13",
16
- "Development Status :: 3 - Alpha"
16
+ "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only"
17
20
  ]
18
21
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
19
22
  dependencies = [
@@ -22,6 +25,13 @@ dependencies = [
22
25
  "swarmauri_standard",
23
26
  "fastapi"
24
27
  ]
28
+ keywords = [
29
+ 'swarmauri',
30
+ 'sdk',
31
+ 'standards',
32
+ 'middleware',
33
+ 'logging',
34
+ ]
25
35
 
26
36
  [tool.uv.sources]
27
37
  swarmauri_core = { workspace = true }
@@ -35,6 +45,7 @@ markers = [
35
45
  "unit: Unit tests",
36
46
  "i9n: Integration tests",
37
47
  "r8n: Regression tests",
48
+ "example: Documentation and README examples",
38
49
  "timeout: mark test to timeout after X seconds",
39
50
  "xpass: Expected passes",
40
51
  "xfail: Expected failures",
@@ -1,35 +0,0 @@
1
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
2
-
3
- <p align="center">
4
- <a href="https://pypi.org/project/swarmauri_middleware_logging/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri_middleware_logging" alt="PyPI - Downloads"/>
6
- </a>
7
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_logging/">
8
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_logging.svg"/>
9
- </a>
10
- <a href="https://pypi.org/project/swarmauri_middleware_logging/">
11
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_middleware_logging" alt="PyPI - Python Version"/>
12
- </a>
13
- <a href="https://pypi.org/project/swarmauri_middleware_logging/">
14
- <img src="https://img.shields.io/pypi/l/swarmauri_middleware_logging" alt="PyPI - License"/>
15
- </a>
16
- <a href="https://pypi.org/project/swarmauri_middleware_logging/">
17
- <img src="https://img.shields.io/pypi/v/swarmauri_middleware_logging?label=swarmauri_middleware_logging&color=green" alt="PyPI - swarmauri_middleware_logging"/>
18
- </a>
19
- </p>
20
-
21
- ---
22
-
23
- # Swarmauri Middleware Logging
24
-
25
- Middleware for logging requests and responses in Swarmauri applications.
26
-
27
- ## Installation
28
-
29
- ```bash
30
- pip install swarmauri_middleware_logging
31
- ```
32
-
33
- ## Want to help?
34
-
35
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.