Commit 5d348a95 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

CommitService: logging requests with the wrapper class

This demonstrates how to use `message.Logging`. It is
still quite partial, but we can generalize later, and
make logging of incoming requests more systematic.
parent 10be0d6ac733
Pipeline #22356 passed with stages
in 1 minute and 4 seconds
......@@ -126,7 +126,7 @@
Actually, it always yields one response message, using the empty
response in case the given path does not resolve.
"""
logger.info("TreeEntry request=%r", request)
logger.info("TreeEntry request=%r", message.Logging(request))
repo = self.load_repo(request.repository, context).unfiltered()
changeset = gitlab_revision_changeset(repo, request.revision)
if changeset is None:
......@@ -243,5 +243,6 @@
# logging potentially both resolution failures
if rev_from is None:
logger.warning("cannot resolve 'from' revision in %r", request)
logger.warning("cannot resolve 'from' revision in %r",
message.Logging(request))
if rev_to is None:
......@@ -247,5 +248,6 @@
if rev_to is None:
logger.warning("cannot resolve 'to' revision in %r", request)
logger.warning("cannot resolve 'to' revision in %r",
message.Logging(request))
if rev_from is None or rev_to is None:
revs = []
......@@ -307,5 +309,6 @@
rev_to = gitlab_revision_changeset(repo, getattr(request, 'to'))
max_count = request.max_count
if rev_from is None:
logger.warning("cannot resolve 'from' revision in %r", request)
logger.warning("cannot resolve 'from' revision in %r",
message.Logging(request))
if rev_to is None:
......@@ -311,5 +314,6 @@
if rev_to is None:
logger.warning("cannot resolve 'to' revision in %r", request)
logger.warning("cannot resolve 'to' revision in %r",
message.Logging(request))
if rev_from is None or rev_to is None:
return CountDivergingCommitsResponse(left_count=0, right_count=0)
left = rev_from.rev()
......@@ -332,7 +336,7 @@
def GetTreeEntries(self, request: GetTreeEntriesRequest,
context) -> GetTreeEntriesResponse:
logger.info("GetTreeEntries request=%r", request)
logger.info("GetTreeEntries request=%r", message.Logging(request))
repo = self.load_repo(request.repository, context).unfiltered()
revision = request.revision
changeset = gitlab_revision_changeset(repo, revision)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment