diff --git a/CHANGELOG.md b/CHANGELOG.md index bfad344..e1ac3a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## v1.9.1 3/11/26 +- Add merge_contextvars to default structlog configuration + ## v1.9.0 3/10/26 - Add capability to upload arbitrary file type to S3 diff --git a/pyproject.toml b/pyproject.toml index c0a20e8..ec7f11e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "nypl_py_utils" -version = "1.9.0" +version = "1.9.1" authors = [ { name="Aaron Friedman", email="aaronfriedman@nypl.org" }, ] diff --git a/src/nypl_py_utils/functions/log_helper.py b/src/nypl_py_utils/functions/log_helper.py index 1370c64..5d1a38b 100644 --- a/src/nypl_py_utils/functions/log_helper.py +++ b/src/nypl_py_utils/functions/log_helper.py @@ -15,18 +15,19 @@ # Configure structlog to be machine-readable first and foremost # while still making it easy for humans to parse # End result (without additional bindings) is JSON like this: -# -# { "logger": "module param" -# "message": "this is a test log event", -# "level": "info", -# "timestamp": "2023-11-01 18:50:47"} -# +# { +# "logger": "module param", +# "message": "this is a test log event", +# "level": "info", +# "timestamp": "2023-11-01 18:50:47" +# } def get_structlog(module): structlog.configure( processors=[ + structlog.contextvars.merge_contextvars, structlog.processors.add_log_level, - structlog.processors.TimeStamper(fmt="iso"), - structlog.processors.EventRenamer("message"), + structlog.processors.TimeStamper(fmt='iso'), + structlog.processors.EventRenamer('message'), structlog.processors.JSONRenderer(), ], context_class=dict,