Skip to content

Commit

Permalink
Merge pull request #180 from aclemons/payload-names-loggers
Browse files Browse the repository at this point in the history
Separate request and response logging into other named loggers.
  • Loading branch information
ojii authored Jul 13, 2024
2 parents ca86d46 + 5628360 commit d98a867
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aiodynamo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/aiodynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit d98a867

Please sign in to comment.