Skip to content

Commit

Permalink
Fixed sources had wrong logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePromidius committed Feb 8, 2024
1 parent fe057f0 commit c1c4893
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from src.Settings.Settings import Settings

pattern = r"anilist.com/manga/(\d+)"
logger = logging.getLogger()

class AniListPerson(StrEnum):
OriginalStory = "original_story", # Original Story
CharacterDesign = "character_design", # Character Design
Expand Down Expand Up @@ -130,7 +130,7 @@ def get_cinfo(cls, comic_info_from_ui: ComicInfo) -> ComicInfo | None:

# Title (Series & LocalizedSeries)
title = data.get("title")
logger.info("[AniList] Fetch Data found title " + str(title) + " for " + comic_info_from_ui.series)
cls._log.info("[AniList] Fetch Data found title " + str(title) + " for " + comic_info_from_ui.series)
title_english = (data.get("title").get("english") or "").strip()
title_romaji = (data.get("title").get("romaji") or "").strip()
if cls.romaji_as_series:
Expand Down Expand Up @@ -159,19 +159,19 @@ def _post(cls, query, variables, logging_info):
if response.status_code == 429: # Anilist rate-limit code
raise AniListRateLimit()
except AniListRateLimit:
logger.exception("Hitted anilist ratelimit")
cls._log.exception("Hitted anilist ratelimit")
return None
except Exception:
logger.exception("Unhandled exception making the request to anilist")
cls._log.exception("Unhandled exception making the request to anilist")
return None

logger.debug(f'Query: {query}')
logger.debug(f'Variables: {variables}')
cls._log.debug(f'Query: {query}')
cls._log.debug(f'Variables: {variables}')
# self.logger.debug(f'Response JSON: {response.json()}')
try:
return response.json()['data']['Media']
except TypeError:
logger.exception("Wrong data format recieved when parsing response json")
cls._log.exception("Wrong data format recieved when parsing response json")
return None

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ def _get_series_id(cls, search_params, logging_info):
try:
response = requests.post('https://api.mangaupdates.com/v1/series/search', json=search_params)
except Exception as e:
cls.logger.exception(e, extra=logging_info)
cls.logger.warning('Manga Manager is unfamiliar with this error. Please log an issue for investigation.',
cls._log.exception(e, extra=logging_info)
cls._log.warning('Manga Manager is unfamiliar with this error. Please log an issue for investigation.',
extra=logging_info)
return None

cls.logger.debug(f'Search Params: {search_params}')
cls._log.debug(f'Search Params: {search_params}')
# cls.logger.debug(f'Response JSON: {response.json()}')

if len(response.json()['results']) == 0:
Expand All @@ -115,8 +115,8 @@ def _get_series_details(cls, manga_title, logging_info):
try:
series_details = requests.get('https://api.mangaupdates.com/v1/series/' + str(cls._get_series_id(search_params, {})))
except Exception as e:
cls.logger.exception(e, extra=logging_info)
cls.logger.warning('Manga Manager is unfamiliar with this error. Please log an issue for investigation.',
cls._log.exception(e, extra=logging_info)
cls._log.warning('Manga Manager is unfamiliar with this error. Please log an issue for investigation.',
extra=logging_info)
return None

Expand Down

0 comments on commit c1c4893

Please sign in to comment.