An AWS approved version of https://github.com/TeoZosa/structlog-sentry-logger which is compatible to AWS Lambda as well as AWS Fargate
Project description
structlog-sentry-lambda
Description
This repository is a fork of https://github.com/TeoZosa/structlog-sentry-logger and all credits for this solution should go to @TeoZosa !!!
Use this ONLY if you are planning to integrate this into AWS Lambda or AWS Fargate.
For any other use-case, check the original repository.
Notes
Sentry SDK Initialization is NOT done within this library.
If you're going to use this library, you need to ensure that the Sentry SDK is properly initialized before importing the library.
Example:
import os
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
sentry_sdk.init(
dsn=os.environ.get('SENTRY_DSN'),
integrations=
[AwsLambdaIntegration(timeout_warning=True)]
if str(os.getenv('SENTRY_INTEGRATION', 'lambda')).lower() == 'lambda'
else [],
environment=os.environ.get('SENTRY_ENV'),
send_default_pii=False,
traces_sample_rate=1.0,
release=os.environ.get('SENTRY_RELEASE')
)
import structlog_sentry_lambda
SENTRY_LOGGER = structlog_sentry_lambda.get_logger()
logger = SENTRY_LOGGER.bind()
logger.info("This is a breadcrumb")
logger.error("This will trigger an error in Sentry")
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
Built Distribution
Close
Hashes for structlog-sentry-lambda-1.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d745313122532254bdda555ba26321fe7e6e3277510c2b98d92a470099d34ef7 |
|
MD5 | 30a0aa6c8295cebec498a089659957e5 |
|
BLAKE2b-256 | a53cebe14351ba29bb92b84b815df059e17b7289ebc66195e684d20adf254c4e |
Close
Hashes for structlog_sentry_lambda-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a89f0d60ea0b0fc5d5d6b43cc4dc887ba5622fa1d758dafe3307be7c36b9ea82 |
|
MD5 | 2f43fddd8d6c675aee2af32db362a08c |
|
BLAKE2b-256 | 6acda39320f4da2443d2bb396b3319b91ea367e07f0f665a9fb2febe014ce670 |