mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-11 18:50:00 -04:00
Remove usage of deprecated logger.warn method from codebase (#6271)
Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
This commit is contained in:
parent
0467f33584
commit
54fef094b3
65 changed files with 164 additions and 149 deletions
|
@ -535,7 +535,7 @@ class SimpleHttpClient(object):
|
|||
b"Content-Length" in resp_headers
|
||||
and int(resp_headers[b"Content-Length"][0]) > max_size
|
||||
):
|
||||
logger.warn("Requested URL is too large > %r bytes" % (self.max_size,))
|
||||
logger.warning("Requested URL is too large > %r bytes" % (self.max_size,))
|
||||
raise SynapseError(
|
||||
502,
|
||||
"Requested file is too large > %r bytes" % (self.max_size,),
|
||||
|
@ -543,7 +543,7 @@ class SimpleHttpClient(object):
|
|||
)
|
||||
|
||||
if response.code > 299:
|
||||
logger.warn("Got %d when downloading %s" % (response.code, url))
|
||||
logger.warning("Got %d when downloading %s" % (response.code, url))
|
||||
raise SynapseError(502, "Got error %d" % (response.code,), Codes.UNKNOWN)
|
||||
|
||||
# TODO: if our Content-Type is HTML or something, just read the first
|
||||
|
|
|
@ -148,7 +148,7 @@ class SrvResolver(object):
|
|||
# Try something in the cache, else rereaise
|
||||
cache_entry = self._cache.get(service_name, None)
|
||||
if cache_entry:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"Failed to resolve %r, falling back to cache. %r", service_name, e
|
||||
)
|
||||
return list(cache_entry)
|
||||
|
|
|
@ -149,7 +149,7 @@ def _handle_json_response(reactor, timeout_sec, request, response):
|
|||
|
||||
body = yield make_deferred_yieldable(d)
|
||||
except Exception as e:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"{%s} [%s] Error reading response: %s",
|
||||
request.txn_id,
|
||||
request.destination,
|
||||
|
@ -457,7 +457,7 @@ class MatrixFederationHttpClient(object):
|
|||
except Exception as e:
|
||||
# Eh, we're already going to raise an exception so lets
|
||||
# ignore if this fails.
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"{%s} [%s] Failed to get error response: %s %s: %s",
|
||||
request.txn_id,
|
||||
request.destination,
|
||||
|
@ -478,7 +478,7 @@ class MatrixFederationHttpClient(object):
|
|||
|
||||
break
|
||||
except RequestSendFailed as e:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"{%s} [%s] Request failed: %s %s: %s",
|
||||
request.txn_id,
|
||||
request.destination,
|
||||
|
@ -513,7 +513,7 @@ class MatrixFederationHttpClient(object):
|
|||
raise
|
||||
|
||||
except Exception as e:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"{%s} [%s] Request failed: %s %s: %s",
|
||||
request.txn_id,
|
||||
request.destination,
|
||||
|
@ -889,7 +889,7 @@ class MatrixFederationHttpClient(object):
|
|||
d.addTimeout(self.default_timeout, self.reactor)
|
||||
length = yield make_deferred_yieldable(d)
|
||||
except Exception as e:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"{%s} [%s] Error reading response: %s",
|
||||
request.txn_id,
|
||||
request.destination,
|
||||
|
|
|
@ -170,7 +170,7 @@ class RequestMetrics(object):
|
|||
tag = context.tag
|
||||
|
||||
if context != self.start_context:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"Context have unexpectedly changed %r, %r",
|
||||
context,
|
||||
self.start_context,
|
||||
|
|
|
@ -454,7 +454,7 @@ def respond_with_json(
|
|||
# the Deferred fires, but since the flag is RIGHT THERE it seems like
|
||||
# a waste.
|
||||
if request._disconnected:
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"Not sending response to request %s, already disconnected.", request
|
||||
)
|
||||
return
|
||||
|
|
|
@ -219,13 +219,13 @@ def parse_json_value_from_request(request, allow_empty_body=False):
|
|||
try:
|
||||
content_unicode = content_bytes.decode("utf8")
|
||||
except UnicodeDecodeError:
|
||||
logger.warn("Unable to decode UTF-8")
|
||||
logger.warning("Unable to decode UTF-8")
|
||||
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
|
||||
|
||||
try:
|
||||
content = json.loads(content_unicode)
|
||||
except Exception as e:
|
||||
logger.warn("Unable to parse JSON: %s", e)
|
||||
logger.warning("Unable to parse JSON: %s", e)
|
||||
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
|
||||
|
||||
return content
|
||||
|
|
|
@ -199,7 +199,7 @@ class SynapseRequest(Request):
|
|||
# It's useful to log it here so that we can get an idea of when
|
||||
# the client disconnects.
|
||||
with PreserveLoggingContext(self.logcontext):
|
||||
logger.warn(
|
||||
logger.warning(
|
||||
"Error processing request %r: %s %s", self, reason.type, reason.value
|
||||
)
|
||||
|
||||
|
@ -305,7 +305,7 @@ class SynapseRequest(Request):
|
|||
try:
|
||||
self.request_metrics.stop(self.finish_time, self.code, self.sentLength)
|
||||
except Exception as e:
|
||||
logger.warn("Failed to stop metrics: %r", e)
|
||||
logger.warning("Failed to stop metrics: %r", e)
|
||||
|
||||
|
||||
class XForwardedForRequest(SynapseRequest):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue