v1.0.1
release-drafter
released this
05 Jul 19:46
·
4020 commits
to develop
since this release
Changes
Quick bugfix to Logger causing additional keys to be dropped when added before logger.inject_lambda_context
was called.
This only happened in two typical situations, and is now fixed with this release
- Additional keys added as part of global scope
from aws_lambda_powertools import Logger
logger = Logger()
logger.structured_logs(some_key="some_value") # some_key won't be available within the handler
@logger.inject_lambda_context
def handler(evt, ctx):
...
- Additional keys added as part of a custom middleware or a Layer that executed before
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
@lambda_handler_decorator(trace_execution=True)
def process_booking_handler(
handler: Callable, event: Dict, context: Any, logger: Logger = None
) -> Callable:
if logger is None:
logger = Logger()
# Add Step Functions specific keys from state into the Logger
# Add Lambda contextual info incl cold start into the Logger
_logger_inject_process_booking_sfn(logger=logger, event=event)
handler = logger.inject_lambda_context(handler)
return handler(event, context)
🐛 Bug and hot fixes
- fix: append structured logs when injecting lambda context (#86) by @heitorlessa