[output] add 'Logger.traceback()' helper

This commit is contained in:
Mike Fährmann
2025-10-14 18:44:29 +02:00
parent 9d054ad18d
commit 8c62be343e
15 changed files with 33 additions and 27 deletions

View File

@@ -211,7 +211,7 @@ class CivitaiExtractor(Extractor):
try:
return self.api.image_generationdata(image["id"])
except Exception as exc:
return self.log.debug("", exc_info=exc)
return self.log.traceback(exc)
def _extract_meta_post(self, image):
try:
@@ -220,7 +220,7 @@ class CivitaiExtractor(Extractor):
post["publishedAt"], "%Y-%m-%dT%H:%M:%S.%fZ")
return post
except Exception as exc:
return self.log.debug("", exc_info=exc)
return self.log.traceback(exc)
def _extract_meta_version(self, item, is_post=True):
try:
@@ -228,7 +228,7 @@ class CivitaiExtractor(Extractor):
version = self.api.model_version(version_id).copy()
return version.pop("model", None), version
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
return None, None
def _extract_version_id(self, item, is_post=True):

View File

@@ -404,7 +404,7 @@ class DeviantartExtractor(Extractor):
try:
return self._tiptap_to_html(markup)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.error("%s: '%s: %s'", deviation["index"],
exc.__class__.__name__, exc)

View File

@@ -79,7 +79,7 @@ class FanslyExtractor(Extractor):
try:
self._extract_attachment(files, post, attachment)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.error(
"%s/%s, Failed to extract media (%s: %s)",
post["id"], attachment.get("id"),

View File

@@ -38,7 +38,7 @@ class FlickrExtractor(Extractor):
self.log.warning(
"Skipping photo %s (%s: %s)",
photo["id"], exc.__class__.__name__, exc)
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
else:
photo.update(data)
url = self._file_url(photo)

View File

@@ -68,7 +68,7 @@ class IssuuUserExtractor(IssuuBase, Extractor):
data = text.extr(html, '\\"docs\\":', '}]\\n"]')
docs = util.json_loads(data.replace('\\"', '"'))
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
return
for publication in docs:

View File

@@ -58,7 +58,7 @@ class NewgroundsExtractor(Extractor):
post = self.extract_post(post_url)
url = post.get("url")
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
url = None
if url:

View File

@@ -46,7 +46,7 @@ class PinterestExtractor(Extractor):
try:
files = self._extract_files(pin)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning(
"%s: Error when extracting download URLs (%s: %s)",
pin.get("id"), exc.__class__.__name__, exc)

View File

@@ -149,7 +149,7 @@ class PixivExtractor(Extractor):
self._extract_ajax(work, body)
return self._extract_ugoira(work, url)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning(
"%s: Unable to extract Ugoira URL. Provide "
"logged-in cookies to access it", work["id"])
@@ -453,7 +453,7 @@ class PixivArtworksExtractor(PixivExtractor):
ajax_ids.extend(map(int, body["manga"]))
ajax_ids.sort()
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning("u%s: Failed to collect artwork IDs "
"using AJAX API", self.user_id)
else:

View File

@@ -214,7 +214,7 @@ class TiktokUserExtractor(TiktokExtractor):
except (ImportError, SyntaxError) as exc:
self.log.error("Cannot import module '%s'",
getattr(exc, "name", ""))
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
raise exception.ExtractionError("yt-dlp or youtube-dl is required "
"for this feature!")

View File

@@ -146,7 +146,7 @@ class TwitterExtractor(Extractor):
self._extract_media(
data, data["extended_entities"]["media"], files)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning(
"%s: Error while extracting media files (%s: %s)",
data["id_str"], exc.__class__.__name__, exc)
@@ -155,7 +155,7 @@ class TwitterExtractor(Extractor):
try:
self._extract_card(tweet, files)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning(
"%s: Error while extracting Card files (%s: %s)",
data["id_str"], exc.__class__.__name__, exc)
@@ -164,7 +164,7 @@ class TwitterExtractor(Extractor):
try:
self._extract_twitpic(data, files)
except Exception as exc:
self.log.debug("", exc_info=exc)
self.log.traceback(exc)
self.log.warning(
"%s: Error while extracting TwitPic files (%s: %s)",
data["id_str"], exc.__class__.__name__, exc)