Skip to content

Commit

Permalink
fix: ensure debug log event has latest ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Sep 1, 2020
1 parent ccd882f commit 20e7f33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aws_lambda_powertools/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ def handler(event, context):

@functools.wraps(lambda_handler)
def decorate(event, context):
lambda_context = build_lambda_context_model(context)
cold_start = _is_cold_start()
self.structure_logs(append=True, cold_start=cold_start, **lambda_context.__dict__)

if log_event:
logger.debug("Event received")
self.info(event)

lambda_context = build_lambda_context_model(context)
cold_start = _is_cold_start()

self.structure_logs(append=True, cold_start=cold_start, **lambda_context.__dict__)
return lambda_handler(event, context)

return decorate
Expand Down

0 comments on commit 20e7f33

Please sign in to comment.