mh_structlog 0.0.40__tar.gz → 0.0.41__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/PKG-INFO +3 -1
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/pyproject.toml +4 -1
- mh_structlog-0.0.41/src/mh_structlog/aws.py +18 -0
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/src/mh_structlog/utils.py +1 -1
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/README.md +0 -0
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/src/mh_structlog/__init__.py +0 -0
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/src/mh_structlog/config.py +0 -0
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/src/mh_structlog/django.py +0 -0
- {mh_structlog-0.0.40 → mh_structlog-0.0.41}/src/mh_structlog/processors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mh_structlog
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.41
|
|
4
4
|
Summary: Some Structlog configuration and wrappers to easily use structlog.
|
|
5
5
|
Author: Mathieu Hinderyckx
|
|
6
6
|
Author-email: Mathieu Hinderyckx <mathieu.hinderyckx@gmail.com>
|
|
@@ -11,8 +11,10 @@ Requires-Dist: orjson>=3.11.5
|
|
|
11
11
|
Requires-Dist: rich>=14.0.0
|
|
12
12
|
Requires-Dist: structlog>=25.5.0
|
|
13
13
|
Requires-Dist: structlog-sentry>=2.2.1
|
|
14
|
+
Requires-Dist: aws-lambda-powertools>=3.23.0 ; extra == 'aws'
|
|
14
15
|
Requires-Dist: django>=5.0 ; extra == 'django'
|
|
15
16
|
Requires-Python: >=3.11
|
|
17
|
+
Provides-Extra: aws
|
|
16
18
|
Provides-Extra: django
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
18
20
|
|
|
@@ -8,7 +8,7 @@ authors = [
|
|
|
8
8
|
{ name = "Mathieu Hinderyckx", email = "mathieu.hinderyckx@gmail.com" },
|
|
9
9
|
]
|
|
10
10
|
description = "Some Structlog configuration and wrappers to easily use structlog."
|
|
11
|
-
version = "0.0.
|
|
11
|
+
version = "0.0.41"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.11"
|
|
14
14
|
classifiers = [
|
|
@@ -26,6 +26,9 @@ dependencies = [
|
|
|
26
26
|
django = [
|
|
27
27
|
"django>=5.0",
|
|
28
28
|
]
|
|
29
|
+
aws = [
|
|
30
|
+
"aws-lambda-powertools>=3.23.0",
|
|
31
|
+
]
|
|
29
32
|
|
|
30
33
|
[tool.setuptools_scm]
|
|
31
34
|
version_file = "src/mh_structlog/_version.py"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import structlog
|
|
2
|
+
from aws_lambda_powertools.utilities.typing import LambdaContext
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def bind_lambda_context(lambda_context: LambdaContext) -> None:
|
|
6
|
+
"""Bind AWS Lambda context information to the structlog context variables, so log entries contain Lambda function metadata.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
lambda_context (LambdaContext): The AWS Lambda context object.
|
|
10
|
+
"""
|
|
11
|
+
if lambda_context:
|
|
12
|
+
structlog.contextvars.clear_contextvars()
|
|
13
|
+
structlog.contextvars.bind_contextvars(
|
|
14
|
+
function_name=lambda_context.function_name,
|
|
15
|
+
function_memory_size=lambda_context.memory_limit_in_mb,
|
|
16
|
+
function_arn=lambda_context.invoked_function_arn,
|
|
17
|
+
function_request_id=lambda_context.aws_request_id,
|
|
18
|
+
)
|
|
@@ -14,7 +14,7 @@ def determine_name_for_logger():
|
|
|
14
14
|
name: str = frame[1].lstrip('/').rstrip('.py').replace('/', '.')
|
|
15
15
|
|
|
16
16
|
# Strip away some common 'prefixes' paths
|
|
17
|
-
for location in ['src', 'code', 'app']:
|
|
17
|
+
for location in ['var.task', 'src', 'code', 'app']:
|
|
18
18
|
if f'{location}.' in name:
|
|
19
19
|
_, _, name = name.partition(f'{location}.')
|
|
20
20
|
break
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|