mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Delay printf until logging is required.
Using % will cause the string to be generated even if debugging is off.
This commit is contained in:
parent
9eebc1e73b
commit
8f4a808d9d
@ -113,8 +113,8 @@ class SyncRestServlet(RestServlet):
|
||||
|
||||
logger.debug(
|
||||
"/sync: user=%r, timeout=%r, since=%r, "
|
||||
" set_presence=%r, filter_id=%r, device_id=%r"
|
||||
% (user, timeout, since, set_presence, filter_id, device_id)
|
||||
"set_presence=%r, filter_id=%r, device_id=%r",
|
||||
user, timeout, since, set_presence, filter_id, device_id
|
||||
)
|
||||
|
||||
request_key = (user, timeout, since, filter_id, full_state, device_id)
|
||||
|
@ -117,8 +117,8 @@ class PreviewUrlResource(DirectServeResource):
|
||||
pattern = entry[attrib]
|
||||
value = getattr(url_tuple, attrib)
|
||||
logger.debug(
|
||||
("Matching attrib '%s' with value '%s' against" " pattern '%s'")
|
||||
% (attrib, value, pattern)
|
||||
"Matching attrib '%s' with value '%s' against" " pattern '%s'",
|
||||
attrib, value, pattern
|
||||
)
|
||||
|
||||
if value is None:
|
||||
@ -186,7 +186,7 @@ class PreviewUrlResource(DirectServeResource):
|
||||
|
||||
media_info = yield self._download_url(url, user)
|
||||
|
||||
logger.debug("got media_info of '%s'" % media_info)
|
||||
logger.debug("got media_info of '%s'", media_info)
|
||||
|
||||
if _is_media(media_info["media_type"]):
|
||||
file_id = media_info["filesystem_id"]
|
||||
@ -254,7 +254,7 @@ class PreviewUrlResource(DirectServeResource):
|
||||
og["og:image:width"] = dims["width"]
|
||||
og["og:image:height"] = dims["height"]
|
||||
else:
|
||||
logger.warn("Couldn't get dims for %s" % og["og:image"])
|
||||
logger.warn("Couldn't get dims for %s", og["og:image"])
|
||||
|
||||
og["og:image"] = "mxc://%s/%s" % (
|
||||
self.server_name,
|
||||
@ -268,7 +268,7 @@ class PreviewUrlResource(DirectServeResource):
|
||||
logger.warn("Failed to find any OG data in %s", url)
|
||||
og = {}
|
||||
|
||||
logger.debug("Calculated OG for %s as %s" % (url, og))
|
||||
logger.debug("Calculated OG for %s as %s", url, og)
|
||||
|
||||
jsonog = json.dumps(og)
|
||||
|
||||
@ -297,7 +297,7 @@ class PreviewUrlResource(DirectServeResource):
|
||||
|
||||
with self.media_storage.store_into_file(file_info) as (f, fname, finish):
|
||||
try:
|
||||
logger.debug("Trying to get url '%s'" % url)
|
||||
logger.debug("Trying to get url '%s'", url)
|
||||
length, headers, uri, code = yield self.client.get_file(
|
||||
url, output_stream=f, max_size=self.max_spider_size
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user