Feature request: logEvent method for manual usage #1006
Labels
feature-request
This item refers to a feature request for an existing or new utility
good-first-issue
Something that is suitable for those who want to start contributing
logger
This item relates to the Logger Utility
rejected
This is something we will not be working on. At least, not in the measurable future
Description of the feature request
Problem statement
PR #1004 introduced a new behaviour in the Logger decorator and middleware that allows to emit a log entry that contains the handler's
event
payload.It would be great if this feature was available also for those users who don't use decorators or middy middleware.
In addition, a couple of changes related to this topic could be made in other sections:
packages/logger/src/middy.ts
docstring of theinjectLambdaContext
middleware we should document the new flag/new behaviour so that it appears also in the API docs.Summary of the feature
Add public method like
logger.logEvent(event);
, as well as the changes listed above.Code examples
N/A
Benefits for you and the wider AWS community
Better DX for users who want log the handler's event parameter during development / debugging but are not using middleware nor decorator.
Describe alternatives you've considered
Logging the event directly
logger.debug('event', { event });
The above is not admittedly that bad, I convene that this proposal is purely syntactic sugar.
Additional context
N/A
Related issues, RFCs
#1004
The text was updated successfully, but these errors were encountered: