cuneus 0.2.7__tar.gz → 0.2.8__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.4
2
2
  Name: cuneus
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: ASGI application wrapper
5
5
  Project-URL: Homepage, https://github.com/rmyers/cuneus
6
6
  Project-URL: Documentation, https://github.com/rmyers/cuneus#readme
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cuneus"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "ASGI application wrapper"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Robert Myers", email = "robert@julython.org" }]
@@ -5,6 +5,7 @@ Structured logging with structlog and request context.
5
5
  from __future__ import annotations
6
6
 
7
7
  import logging
8
+ import shutil
8
9
  import time
9
10
  import uuid
10
11
  from typing import Any, Awaitable, Callable
@@ -36,9 +37,14 @@ def configure_structlog(settings: Settings | None = None) -> None:
36
37
  structlog.processors.UnicodeDecoder(),
37
38
  ]
38
39
 
39
- renderer: structlog.types.Processor = structlog.dev.ConsoleRenderer(colors=True)
40
- if log_settings.log_json: # pragma: no cover
41
- renderer = structlog.processors.JSONRenderer()
40
+ renderer = structlog.processors.JSONRenderer()
41
+
42
+ if not log_settings.log_json: # pragma: no branch
43
+ term_width = shutil.get_terminal_size().columns
44
+ pad_event = term_width - 36
45
+ renderer: structlog.types.Processor = structlog.dev.ConsoleRenderer(
46
+ colors=True, pad_event=pad_event
47
+ )
42
48
 
43
49
  # Configure structlog
44
50
  structlog.configure(
@@ -84,10 +90,6 @@ class LoggingExtension(BaseExtension):
84
90
  self.settings = settings or Settings()
85
91
  configure_structlog(settings)
86
92
 
87
- async def startup(self, registry: svcs.Registry, app: FastAPI) -> dict[str, Any]:
88
- # app.add_middleware(RequestLoggingMiddleware)
89
- return {}
90
-
91
93
  def middleware(self) -> list[Middleware]:
92
94
  return [
93
95
  Middleware(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes