Nanolib to enhance logging in aws lambda
Project description
Better logging for aws lambda running on python runtime environment with a highly opinionated json formatting to ease parsing on any logging system.
Usage
import aws_lambda_logging
def handler(event, context):
aws_lambda_logging.setup(level='DEBUG')
...
You can add keyword arguments to be logged each time, such as lambda request id.
import aws_lambda_logging
def handler(event, context):
aws_lambda_logging.setup(level='DEBUG',
aws_request_id=context.get('aws_request_id'))
log.debug('Just a try!')
...
It will output json formatted message:
{
"level": "DEBUG",
"timestamp": "2016-10-03 13:27:57,438",
"apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
"location": "root.handler:6",
"message": "Just a try!"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for aws_lambda_logging-0.0.15.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f67335eff6572d0183327ef1efd44eedc05758b6d4fee9a4835782ae7da7d0d |
|
MD5 | 577f607fcfac2843c4cde0a33549686b |
|
BLAKE2b-256 | db0139aab4173c440f7ec8192eba056c7e1f53ff82a77d353da1054b51dbcb58 |