summary refs log tree commit diff
path: root/synapse/crypto
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-25 10:05:44 +0100
committerGitHub <noreply@github.com>2019-10-25 10:05:44 +0100
commit44ab048cfe53607ed4ebe42bd10db389c5e587f8 (patch)
treed56983cfbfa80b15926dea010b4613f5d870a2ae /synapse/crypto
parentMerge pull request #6250 from matrix-org/michaelkaye/make_user_stats_less_ver... (diff)
parentAddress codestyle concerns (diff)
downloadsynapse-44ab048cfe53607ed4ebe42bd10db389c5e587f8.tar.xz
Merge pull request #6251 from matrix-org/michaelkaye/debug_guard_logging
Reduce debug logging overhead
Diffstat (limited to 'synapse/crypto')
-rw-r--r--synapse/crypto/event_signing.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/crypto/event_signing.py b/synapse/crypto/event_signing.py
index 694fb2c816..ccaa8a9920 100644
--- a/synapse/crypto/event_signing.py
+++ b/synapse/crypto/event_signing.py
@@ -125,9 +125,11 @@ def compute_event_signature(event_dict, signature_name, signing_key):
     redact_json = prune_event_dict(event_dict)
     redact_json.pop("age_ts", None)
     redact_json.pop("unsigned", None)
-    logger.debug("Signing event: %s", encode_canonical_json(redact_json))
+    if logger.isEnabledFor(logging.DEBUG):
+        logger.debug("Signing event: %s", encode_canonical_json(redact_json))
     redact_json = sign_json(redact_json, signature_name, signing_key)
-    logger.debug("Signed event: %s", encode_canonical_json(redact_json))
+    if logger.isEnabledFor(logging.DEBUG):
+        logger.debug("Signed event: %s", encode_canonical_json(redact_json))
     return redact_json["signatures"]