mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
additional logs in handler for local testing
This commit is contained in:
parent
cc901d999b
commit
3dbe118b38
1 changed files with 6 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
from typing import Any, Mapping
|
||||
|
||||
from backend.categorisation.categorisation_trigger_request import (
|
||||
CategorisationTriggerRequest,
|
||||
)
|
||||
|
|
@ -12,6 +13,10 @@ logger = setup_logger()
|
|||
|
||||
def handler(event: Mapping[str, Any], context: Any) -> None:
|
||||
|
||||
logger.info("Received message")
|
||||
|
||||
logger.info(f"Number of events: {len(event.get('Records', []))}")
|
||||
|
||||
for record in event.get("Records", []):
|
||||
try:
|
||||
body_dict = json.loads(record["body"])
|
||||
|
|
@ -27,4 +32,5 @@ def handler(event: Mapping[str, Any], context: Any) -> None:
|
|||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.info("Handler exception")
|
||||
logger.error(f"Failed to process record: {e}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue