structlog-config 0.4.1__py3-none-any.whl → 0.4.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.
- structlog_config/__init__.py +0 -3
- structlog_config/fastapi_access_logger.py +8 -1
- {structlog_config-0.4.1.dist-info → structlog_config-0.4.2.dist-info}/METADATA +1 -1
- {structlog_config-0.4.1.dist-info → structlog_config-0.4.2.dist-info}/RECORD +5 -5
- {structlog_config-0.4.1.dist-info → structlog_config-0.4.2.dist-info}/WHEEL +0 -0
structlog_config/__init__.py
CHANGED
|
@@ -9,9 +9,6 @@ from structlog.processors import ExceptionRenderer
|
|
|
9
9
|
from structlog.tracebacks import ExceptionDictTransformer
|
|
10
10
|
from structlog.typing import FilteringBoundLogger
|
|
11
11
|
|
|
12
|
-
from structlog_config.fastapi_access_logger import (
|
|
13
|
-
client_ip_from_request,
|
|
14
|
-
)
|
|
15
12
|
from structlog_config.formatters import (
|
|
16
13
|
PathPrettifier,
|
|
17
14
|
add_fastapi_context,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Requires fastapi and is not loaded by default since fastapi is not a default dependency.
|
|
3
|
+
"""
|
|
4
|
+
|
|
1
5
|
from time import perf_counter
|
|
2
6
|
from urllib.parse import quote
|
|
3
7
|
|
|
@@ -11,7 +15,8 @@ from starlette.routing import Match, Mount
|
|
|
11
15
|
from starlette.types import Scope
|
|
12
16
|
from starlette.websockets import WebSocket
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
# should name this access "access_log" or something
|
|
19
|
+
log = structlog.get_logger()
|
|
15
20
|
ipw = IpWare()
|
|
16
21
|
|
|
17
22
|
|
|
@@ -109,6 +114,8 @@ def is_static_assets_request(scope: Scope) -> bool:
|
|
|
109
114
|
)
|
|
110
115
|
|
|
111
116
|
|
|
117
|
+
# TODO issue with this approach is if there is an error we don't get a path logged :/
|
|
118
|
+
# maybe we should log a ERROR with the path information and wrap it with a try?
|
|
112
119
|
def add_middleware(
|
|
113
120
|
app: FastAPI,
|
|
114
121
|
) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: structlog-config
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: A comprehensive structlog configuration with sensible defaults for development and production environments, featuring context management, exception formatting, and path prettification.
|
|
5
5
|
Keywords: logging,structlog,json-logging,structured-logging
|
|
6
6
|
Author: Michael Bianco
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
structlog_config/__init__.py,sha256=
|
|
1
|
+
structlog_config/__init__.py,sha256=DyY4x3_dY_hPNbS1aM7JRCGadTa1dYDIPzgrHu3AP68,6733
|
|
2
2
|
structlog_config/constants.py,sha256=O1nPnB29yZdqqaI7aeTUrimA3LOtA5WpP6BGPLWJvj8,510
|
|
3
3
|
structlog_config/env_config.py,sha256=_EJO0rgAKndRPSh4wuBaH3bui9F3nIpn8FaEkjAjZso,1737
|
|
4
4
|
structlog_config/environments.py,sha256=JpZYVVDGxEf1EaKdPdn6Jo-4wJK6SqF0ueFl7e2TBvI,612
|
|
5
|
-
structlog_config/fastapi_access_logger.py,sha256=
|
|
5
|
+
structlog_config/fastapi_access_logger.py,sha256=QuvteKBZGsEiVaPEpdpsK1jjCYEPKnhmsQDC89M2JKc,5452
|
|
6
6
|
structlog_config/formatters.py,sha256=ll0Y0QeRs1DMmD-ft1n1zA4Vn2STRSK-mOrczYB2OjE,5898
|
|
7
7
|
structlog_config/levels.py,sha256=z1fTpvCCbAwcFK2k7rHWh_p-FqfFh4yIWCTZ1MNf_4U,993
|
|
8
8
|
structlog_config/packages.py,sha256=asxrzLR-iRYAbkoSYutyTdIRcruTjHgkzfe2pjm2VFM,519
|
|
9
9
|
structlog_config/stdlib_logging.py,sha256=Wnn59oRBIqn708CpR-akqVcG9ccSfCMLh56_7wxZRH0,7350
|
|
10
10
|
structlog_config/trace.py,sha256=dBaSynxmw4Wg79wSHqYEMoByvv--v_oQw61dRdg4xUI,2016
|
|
11
11
|
structlog_config/warnings.py,sha256=gKEcuHWqH0BaKitJtQkv-uJ0Z3uCH5nn6k8qpqjR-RM,998
|
|
12
|
-
structlog_config-0.4.
|
|
13
|
-
structlog_config-0.4.
|
|
14
|
-
structlog_config-0.4.
|
|
12
|
+
structlog_config-0.4.2.dist-info/WHEEL,sha256=4n27za1eEkOnA7dNjN6C5-O2rUiw6iapszm14Uj-Qmk,79
|
|
13
|
+
structlog_config-0.4.2.dist-info/METADATA,sha256=wDb3zt_g4fwx5MtN2SvuXqi6O4FzDA-WH7TnYZNoUcg,6329
|
|
14
|
+
structlog_config-0.4.2.dist-info/RECORD,,
|
|
File without changes
|