Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
17 changes: 9 additions & 8 deletions src/nypl_py_utils/functions/log_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading