Skip to content

Commit 20e7f33

Browse files
committed
fix: ensure debug log event has latest ctx
1 parent ccd882f commit 20e7f33

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

aws_lambda_powertools/logging/logger.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ def handler(event, context):
235235

236236
@functools.wraps(lambda_handler)
237237
def decorate(event, context):
238+
lambda_context = build_lambda_context_model(context)
239+
cold_start = _is_cold_start()
240+
self.structure_logs(append=True, cold_start=cold_start, **lambda_context.__dict__)
241+
238242
if log_event:
239243
logger.debug("Event received")
240244
self.info(event)
241245

242-
lambda_context = build_lambda_context_model(context)
243-
cold_start = _is_cold_start()
244-
245-
self.structure_logs(append=True, cold_start=cold_start, **lambda_context.__dict__)
246246
return lambda_handler(event, context)
247247

248248
return decorate

0 commit comments

Comments
 (0)