mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 12:54:53 -04:00
Add type hints to the logging context code. (#8939)
This commit is contained in:
parent
9dde9c9f01
commit
06fefe0bb1
4 changed files with 47 additions and 22 deletions
|
@ -108,7 +108,15 @@ class Measure:
|
|||
def __init__(self, clock, name):
|
||||
self.clock = clock
|
||||
self.name = name
|
||||
parent_context = current_context()
|
||||
curr_context = current_context()
|
||||
if not curr_context:
|
||||
logger.warning(
|
||||
"Starting metrics collection from sentinel context: metrics will be lost"
|
||||
)
|
||||
parent_context = None
|
||||
else:
|
||||
assert isinstance(curr_context, LoggingContext)
|
||||
parent_context = curr_context
|
||||
self._logging_context = LoggingContext(
|
||||
"Measure[%s]" % (self.name,), parent_context
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue