diff --git a/changelog.d/352.feature b/changelog.d/352.feature new file mode 100644 index 00000000..90537fba --- /dev/null +++ b/changelog.d/352.feature @@ -0,0 +1 @@ +Set log level for `/health` endpoint to `DEBUG`. \ No newline at end of file diff --git a/sygnal/http.py b/sygnal/http.py index 86c69043..9669b71d 100644 --- a/sygnal/http.py +++ b/sygnal/http.py @@ -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):