pypi aws-lambda-powertools 1.1.0
v1.1.0

latest releases: 3.3.1a5, 3.3.1a4, 3.3.1a3...
4 years ago

Changes

This release add support for reusing Logger across multiple files in your code base via the new child parameter 🎉🎉🎉

Child Loggers will be named after the convention {service}.{filename} - It now follows the Python Logging inheritance mechanics. Here's a code excerpt to demonstrate how this feature looks like:

app.py - Your typical parent logger will be at your Lambda function handler

# POWERTOOLS_SERVICE_NAME: "payment"
import shared # Creates a child logger named "payment.shared"
from aws_lambda_powertools import Logger

logger = Logger()

def handler(event, context):
  shared.inject_payment_id(event) # highlight-line
  logger.structure_logs(append=True, order_id=event["order_id"]) # highlight-line
      ...

shared.py - You can use Logger(child=True) to explicit tell Logger this should be the child

# POWERTOOLS_SERVICE_NAME: "payment"
from aws_lambda_powertools import Logger

logger = Logger(child=True) # highlight-line

def inject_payment_id(event):
    logger.structure_logs(append=True, payment_id=event["payment_id"])

🌟 Minor Changes

Chore

  • chore(deps): bump lodash from 4.17.15 to 4.17.19 in /docs (#93) by @dependabot

This release was made possible by the following contributors:

@heitorlessa @alexanderluiscampino

Don't miss a new aws-lambda-powertools release

NewReleases is sending notifications on new releases.