Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13.1
3.13
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## v1.10.2 4/27/26
- Prevent double logging in pytest using structlog

## v1.10.1 4/14/26
- Add optional timeout param for OAuth2Client

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.10.1"
version = "1.10.2"
authors = [
{ name="Aaron Friedman", email="aaronfriedman@nypl.org" },
]
Expand Down
5 changes: 4 additions & 1 deletion src/nypl_py_utils/functions/log_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ def get_structlog(module):
without binding it to others, use `logger = logger.bind(contextvar=0)`.
"""
logger = logging.getLogger(module)
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel(os.environ.get('LOG_LEVEL', 'INFO').upper())
logger.propagate = False # Prevents double logging

# No need to add handlers if there already are some (e.g. pytest)
if not logger.handlers:
logger.addHandler(logging.StreamHandler(sys.stdout))

return structlog.wrap_logger(
logger,
processors=[
Expand Down
Loading