mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-27 04:59:23 -05:00
Set parent context on instansiation
This commit is contained in:
parent
e664e9737c
commit
9777c5f49a
@ -79,7 +79,7 @@ class LoggingContext(object):
|
|||||||
sentinel = Sentinel()
|
sentinel = Sentinel()
|
||||||
|
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
self.parent_context = None
|
self.parent_context = LoggingContext.current_context()
|
||||||
self.name = name
|
self.name = name
|
||||||
self.ru_stime = 0.
|
self.ru_stime = 0.
|
||||||
self.ru_utime = 0.
|
self.ru_utime = 0.
|
||||||
@ -116,7 +116,12 @@ class LoggingContext(object):
|
|||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""Enters this logging context into thread local storage"""
|
"""Enters this logging context into thread local storage"""
|
||||||
self.parent_context = self.set_current_context(self)
|
old_context = self.set_current_context(self)
|
||||||
|
if self.parent_context != old_context:
|
||||||
|
logger.warn(
|
||||||
|
"Expected parent context %r, found %r",
|
||||||
|
self.parent_context, old_context
|
||||||
|
)
|
||||||
self.alive = True
|
self.alive = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user