Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Instruments all Lambda invocations
import wrapt
def wrapper(wrapped, instance, args, kwargs):
Wrap all Lambda invocations and prints a log before calling it.
request_handler = args[0]
def _wrapper(event, context):
print 'This is a log'
return request_handler(event, context)
return wrapped(_wrapper, *args[1:], **kwargs)
wrapt.wrap_function_wrapper('__main__', 'handle_event_request', wrapper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.