Skip to main content

Nanolib to enhance logging in aws lambda

Project description

https://gitlab.com/hadr/aws_lambda_logging/badges/master/build.svg https://gitlab.com/hadr/aws_lambda_logging/badges/master/coverage.svg?job=Run%20py.test

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_lambda_logging-0.0.16.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file aws_lambda_logging-0.0.16.tar.gz.

File metadata

File hashes

Hashes for aws_lambda_logging-0.0.16.tar.gz
Algorithm Hash digest
SHA256 c9b0d8d037a6efed652133174af49363e3e579641652bbdc7ab96400dd314d53
MD5 ecb61d05fbfba4a5ba71719ba97766ed
BLAKE2b-256 e2336fef9af4cc63e3812db06f2f8a61b6fbc73919c2999035732578a2463b37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page