structlog-config 0.4.1__tar.gz → 0.4.2__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,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: structlog-config
3
- Version: 0.4.1
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,6 +1,6 @@
1
1
  [project]
2
2
  name = "structlog-config"
3
- version = "0.4.1"
3
+ version = "0.4.2"
4
4
  description = "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
  readme = "README.md"
@@ -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
- log = structlog.get_logger("access_log")
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: