File tree 2 files changed +14
-1
lines changed
aws_lambda_powertools/logging
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -328,7 +328,7 @@ def handler(event, context):
328
328
)
329
329
330
330
@functools .wraps (lambda_handler )
331
- def decorate (event , context ):
331
+ def decorate (event , context , ** kwargs ):
332
332
lambda_context = build_lambda_context_model (context )
333
333
cold_start = _is_cold_start ()
334
334
Original file line number Diff line number Diff line change @@ -597,3 +597,16 @@ def handler(event, context):
597
597
first_log , second_log = capture_multiple_logging_statements_output (stdout )
598
598
assert "my_key" in first_log
599
599
assert "my_key" not in second_log
600
+
601
+
602
+ def test_inject_lambda_context_allows_handler_with_kwargs (lambda_context , stdout , service_name ):
603
+ # GIVEN
604
+ logger = Logger (service = service_name , stream = stdout )
605
+
606
+ # WHEN
607
+ @logger .inject_lambda_context (clear_state = True )
608
+ def handler (event , context , my_custom_option = None ):
609
+ pass
610
+
611
+ # THEN
612
+ handler ({}, lambda_context , my_custom_option = "blah" )
You can’t perform that action at this time.
0 commit comments