simplify some logging calls

This commit is contained in:
Mike Fährmann
2019-12-10 21:30:08 +01:00
parent c9ef1b21c3
commit c4702ec9b6
4 changed files with 6 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ def load(files=None, strict=False, fmt="json"):
confdict = parsefunc(file)
except OSError as exc:
if strict:
log.error("%s", exc)
log.error(exc)
sys.exit(1)
except Exception as exc:
log.warning("Could not parse '%s': %s", path, exc)

View File

@@ -99,7 +99,7 @@ class HttpDownloader(DownloaderBase):
msg = str(exc)
continue
except Exception as exc:
self.log.warning("%s", exc)
self.log.warning(exc)
return False
# check response
@@ -116,7 +116,7 @@ class HttpDownloader(DownloaderBase):
msg = "'{} {}' for '{}'".format(code, response.reason, url)
if code == 429 or 500 <= code < 600: # Server Error
continue
self.log.warning("%s", msg)
self.log.warning(msg)
return False
size = text.parse_int(size)

View File

@@ -243,7 +243,7 @@ class PinterestAPI():
if response.status_code == 404 or response.history:
resource = self.extractor.subcategory.rpartition("-")[2]
raise exception.NotFoundError(resource)
self.extractor.log.debug("%s", response.text)
self.extractor.log.debug("Server response: %s", response.text)
raise exception.StopExtraction("API request failed")
def _pagination(self, resource, options):

View File

@@ -156,8 +156,8 @@ class TumblrExtractor(Extractor):
invalid = types - POST_TYPES
if invalid:
types = types & POST_TYPES
self.log.warning('invalid post types: "%s"',
'", "'.join(sorted(invalid)))
self.log.warning("Invalid post types: '%s'",
"', '".join(sorted(invalid)))
return types
@staticmethod