Skip to content

Commit

Permalink
update start-of-request logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Oct 18, 2024
1 parent dfa3a63 commit cf4a42e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rest_tools/server/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ def get_current_user(self):
@wtt.evented()
def prepare(self):
"""Prepare before http-method request handlers."""
LOGGER.debug(f"{self.request.method} [{self.__class__.__name__}]")

# log at the very start of every new request
logging.info(">>> %s", self._request_summary()) # use the root logger
# ^^^ this mimics the log line that tornado provides at the end of a request:
# see rest_tools.server.tornado_logger().
# ">>>" makes logs line-up (end-of-request log line uses http code: 200, 400, etc.)
LOGGER.debug(f"[{self.__class__.__name__}]")

if self.route_stats is not None:
stat = self.route_stats[self.request.path]
Expand Down

0 comments on commit cf4a42e

Please sign in to comment.