mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Clean up debug logging (#5347)
Remove some spurious stuff, clarify some other stuff
This commit is contained in:
parent
016af01598
commit
2615c6bd9e
2
changelog.d/5347.misc
Normal file
2
changelog.d/5347.misc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Various improvements to debug logging.
|
||||||
|
|
@ -31,7 +31,11 @@ logger = logging.getLogger(__name__)
|
|||||||
def check_event_content_hash(event, hash_algorithm=hashlib.sha256):
|
def check_event_content_hash(event, hash_algorithm=hashlib.sha256):
|
||||||
"""Check whether the hash for this PDU matches the contents"""
|
"""Check whether the hash for this PDU matches the contents"""
|
||||||
name, expected_hash = compute_content_hash(event.get_pdu_json(), hash_algorithm)
|
name, expected_hash = compute_content_hash(event.get_pdu_json(), hash_algorithm)
|
||||||
logger.debug("Expecting hash: %s", encode_base64(expected_hash))
|
logger.debug(
|
||||||
|
"Verifying content hash on %s (expecting: %s)",
|
||||||
|
event.event_id,
|
||||||
|
encode_base64(expected_hash),
|
||||||
|
)
|
||||||
|
|
||||||
# some malformed events lack a 'hashes'. Protect against it being missing
|
# some malformed events lack a 'hashes'. Protect against it being missing
|
||||||
# or a weird type by basically treating it the same as an unhashed event.
|
# or a weird type by basically treating it the same as an unhashed event.
|
||||||
|
@ -866,10 +866,6 @@ def _handle_key_deferred(verify_request):
|
|||||||
|
|
||||||
json_object = verify_request.json_object
|
json_object = verify_request.json_object
|
||||||
|
|
||||||
logger.debug(
|
|
||||||
"Got key %s %s:%s for server %s, verifying"
|
|
||||||
% (key_id, verify_key.alg, verify_key.version, server_name)
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
verify_signed_json(json_object, server_name, verify_key)
|
verify_signed_json(json_object, server_name, verify_key)
|
||||||
except SignatureVerifyException as e:
|
except SignatureVerifyException as e:
|
||||||
|
@ -232,7 +232,8 @@ class FederationClient(FederationBase):
|
|||||||
moving to the next destination. None indicates no timeout.
|
moving to the next destination. None indicates no timeout.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Deferred: Results in the requested PDU.
|
Deferred: Results in the requested PDU, or None if we were unable to find
|
||||||
|
it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: Rate limit the number of times we try and get the same event.
|
# TODO: Rate limit the number of times we try and get the same event.
|
||||||
@ -257,7 +258,12 @@ class FederationClient(FederationBase):
|
|||||||
destination, event_id, timeout=timeout,
|
destination, event_id, timeout=timeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.debug("transaction_data %r", transaction_data)
|
logger.debug(
|
||||||
|
"retrieved event id %s from %s: %r",
|
||||||
|
event_id,
|
||||||
|
destination,
|
||||||
|
transaction_data,
|
||||||
|
)
|
||||||
|
|
||||||
pdu_list = [
|
pdu_list = [
|
||||||
event_from_pdu_json(p, format_ver, outlier=outlier)
|
event_from_pdu_json(p, format_ver, outlier=outlier)
|
||||||
@ -331,7 +337,11 @@ class FederationClient(FederationBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if failed_to_fetch:
|
if failed_to_fetch:
|
||||||
logger.warn("Failed to get %r", failed_to_fetch)
|
logger.warning(
|
||||||
|
"Failed to fetch missing state/auth events for %s: %s",
|
||||||
|
room_id,
|
||||||
|
failed_to_fetch
|
||||||
|
)
|
||||||
|
|
||||||
event_map = {
|
event_map = {
|
||||||
ev.event_id: ev for ev in fetched_events
|
ev.event_id: ev for ev in fetched_events
|
||||||
|
Loading…
Reference in New Issue
Block a user