Refactor LoggingMiddleware constructor to use ASGIApp type hint and remove unused parameters
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
from collections.abc import Awaitable, Callable
|
from collections.abc import Awaitable, Callable
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from fastapi import Request, Response
|
from fastapi import Request, Response
|
||||||
from starlette.middleware.base import BaseHTTPMiddleware
|
from starlette.middleware.base import BaseHTTPMiddleware
|
||||||
|
from starlette.types import ASGIApp
|
||||||
|
|
||||||
from app.core.logging import get_logger
|
from app.core.logging import get_logger
|
||||||
|
|
||||||
@@ -12,9 +12,9 @@ from app.core.logging import get_logger
|
|||||||
class LoggingMiddleware(BaseHTTPMiddleware):
|
class LoggingMiddleware(BaseHTTPMiddleware):
|
||||||
"""Middleware for logging HTTP requests and responses."""
|
"""Middleware for logging HTTP requests and responses."""
|
||||||
|
|
||||||
def __init__(self, app: Any, *args: Any, **kwargs: Any) -> None:
|
def __init__(self, app: ASGIApp) -> None:
|
||||||
"""Initialize the logging middleware."""
|
"""Initialize the logging middleware."""
|
||||||
super().__init__(app, *args, **kwargs)
|
super().__init__(app)
|
||||||
self.logger = get_logger(__name__)
|
self.logger = get_logger(__name__)
|
||||||
|
|
||||||
async def dispatch(
|
async def dispatch(
|
||||||
|
|||||||
Reference in New Issue
Block a user