Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate request and response logging into other named loggers. #180

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/aiodynamo/client.py
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@
)
from .sign import signed_dynamo_request
from .types import Item, NumericTypeConverter, TableName
from .utils import dy2py, logger, py2dy, wait
from .utils import dy2py, logger, py2dy, request_logger, response_logger, wait


@dataclass(frozen=True)
@@ -984,7 +984,7 @@ async def send_request(
region=self.region,
endpoint=self.endpoint,
)
logger.debug("sending request %r", request)
request_logger.debug("sending request %r", request)
try:
response = await self.http(
Request(
@@ -1002,7 +1002,7 @@ async def send_request(
logger.debug("request failed")
exception = exc.inner
continue
logger.debug("got response %r", response)
response_logger.debug("got response %r", response)
if response.status == 200:
return cast(Dict[str, Any], json.loads(response.body))
exception = exception_from_response(response.status, response.body)
2 changes: 2 additions & 0 deletions src/aiodynamo/utils.py
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@

T = TypeVar("T")
logger = logging.getLogger("aiodynamo")
request_logger = logging.getLogger("aiodynamo.request")
response_logger = logging.getLogger("aiodynamo.response")


def py2dy(data: Union[Item, None]) -> Union[DynamoItem, None]: