We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What were you trying to accomplish?
Have a custom middleware to inject additional keys to the Logger as well as using inject_lambda_context.
inject_lambda_context
@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() handler = logger.inject_lambda_context(handler) logger.info("Injecting and annotating process booking state machine") process_booking_context = _build_process_booking_model(event) _logger_inject_process_booking_sfn(logger=logger, event=event) _tracer_annotate_process_booking_sfn(process_booking_context=process_booking_context) return handler(event, context)
Have additional key added to the log when structure_logs is used outside the handler e.g. shared file, before the handler
structure_logs
Any additional key is removed once the handler is executed with inject_lambda_context
inject_lambda_context is overwriting existing structured logs instead of appending
Code
logger = Logger() logger.structure_logs(append=True, additional_key="test") @logger.inject_lambda_context def handler(event, context): logger.info("Hello") # will not contain additional_key handler({}, lambda_context)
How to enable debug mode**
# paste logs here
The text was updated successfully, but these errors were encountered:
fix: append logs when injecting lambda context #85
0d2ab65
fix: append structured logs when injecting lambda context (#86)
0670e5e
* fix: append logs when injecting lambda context #85 * docs: update changelog Signed-off-by: heitorlessa <[email protected]> * chore: bump version to 1.0.1 Signed-off-by: heitorlessa <[email protected]>
heitorlessa
No branches or pull requests
What were you trying to accomplish?
Have a custom middleware to inject additional keys to the Logger as well as using
inject_lambda_context
.Expected Behavior
Have additional key added to the log when
structure_logs
is used outside the handler e.g. shared file, before the handlerCurrent Behavior
Any additional key is removed once the handler is executed with
inject_lambda_context
Possible Solution
inject_lambda_context
is overwriting existing structured logs instead of appendingSteps to Reproduce (for bugs)
structure_logs
beforeinject_lambda_context
is usedCode
Environment
# paste logs here
The text was updated successfully, but these errors were encountered: