diff options
author | Erik Johnston <erik@matrix.org> | 2016-02-03 15:20:00 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-02-03 15:20:00 +0000 |
commit | c8e4d5de7f03a6b3dc7b2dfe2ad6fade008b8557 (patch) | |
tree | dc4409923eab9b949bed5da7c3056efa153f3c40 /synapse/util/logcontext.py | |
parent | Merge pull request #554 from matrix-org/erikj/event_push (diff) | |
parent | Allowing tagging log contexts (diff) | |
download | synapse-c8e4d5de7f03a6b3dc7b2dfe2ad6fade008b8557.tar.xz |
Merge pull request #555 from matrix-org/erikj/logcontext
Allowing tagging log contexts
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r-- | synapse/util/logcontext.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py index 0595c0fa4f..e701092cd8 100644 --- a/synapse/util/logcontext.py +++ b/synapse/util/logcontext.py @@ -47,7 +47,8 @@ class LoggingContext(object): """ __slots__ = [ - "parent_context", "name", "usage_start", "usage_end", "main_thread", "__dict__" + "parent_context", "name", "usage_start", "usage_end", "main_thread", + "__dict__", "tag", ] thread_local = threading.local() @@ -72,6 +73,9 @@ class LoggingContext(object): def add_database_transaction(self, duration_ms): pass + def __nonzero__(self): + return False + sentinel = Sentinel() def __init__(self, name=None): @@ -83,6 +87,7 @@ class LoggingContext(object): self.db_txn_duration = 0. self.usage_start = None self.main_thread = threading.current_thread() + self.tag = "" def __str__(self): return "%s@%x" % (self.name, id(self)) |