mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:26:02 -04:00
Merge pull request #555 from matrix-org/erikj/logcontext
Allowing tagging log contexts
This commit is contained in:
commit
c8e4d5de7f
3 changed files with 42 additions and 16 deletions
|
@ -18,6 +18,7 @@ from ._base import BaseHandler
|
|||
from synapse.streams.config import PaginationConfig
|
||||
from synapse.api.constants import Membership, EventTypes
|
||||
from synapse.util import unwrapFirstError
|
||||
from synapse.util.logcontext import LoggingContext
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
|
@ -140,6 +141,15 @@ class SyncHandler(BaseHandler):
|
|||
A Deferred SyncResult.
|
||||
"""
|
||||
|
||||
context = LoggingContext.current_context()
|
||||
if context:
|
||||
if since_token is None:
|
||||
context.tag = "initial_sync"
|
||||
elif full_state:
|
||||
context.tag = "full_state_sync"
|
||||
else:
|
||||
context.tag = "incremental_sync"
|
||||
|
||||
if timeout == 0 or since_token is None or full_state:
|
||||
# we are going to return immediately, so don't bother calling
|
||||
# notifier.wait_for_events.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue