Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
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
1 change: 1 addition & 0 deletions changelog.d/352.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set log level for `/health` endpoint to `DEBUG`.
11 changes: 10 additions & 1 deletion sygnal/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,18 @@ def log(self, request: server.Request) -> None:
"""Log this request. Called by request.finish."""
# this also works around a bug in twisted.web.http.HTTPFactory which uses a
# monotonic time as an epoch time.

def _should_log_request() -> bool:
"""Whether we should log at INFO that we processed the request."""
if request.path == b"/health":
return False

return True

log_level = logging.INFO if _should_log_request() else logging.DEBUG
log_date_time = datetimeToLogString()
line = self.log_formatter(log_date_time, request)
self.logger.info("Handled request: %s", line)
self.logger.log(log_level, "Handled request: %s", line)


class PushGatewayApiServer(object):
Expand Down