From 28c810b514ffcbbd29a2940aec079be637b57b13 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 19 Mar 2024 11:05:04 +1100 Subject: [PATCH 1/2] feat: base is_debug on effective level vs root log level --- cps/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cps/logger.py b/cps/logger.py index 74f7fb39..9aa076d4 100644 --- a/cps/logger.py +++ b/cps/logger.py @@ -43,13 +43,14 @@ logging.addLevelName(logging.CRITICAL, "CRIT") class _Logger(logging.Logger): def error_or_exception(self, message, stacklevel=2, *args, **kwargs): + is_debug = self.getEffectiveLevel() <= logging.DEBUG if sys.version_info > (3, 7): - if is_debug_enabled(): + if is_debug: self.exception(message, stacklevel=stacklevel, *args, **kwargs) else: self.error(message, stacklevel=stacklevel, *args, **kwargs) else: - if is_debug_enabled(): + if is_debug: self.exception(message, stack_info=True, *args, **kwargs) else: self.error(message, *args, **kwargs) From d6aa29b0956fbef4bc425df7563f1974f31d0a24 Mon Sep 17 00:00:00 2001 From: yunimoo Date: Fri, 31 May 2024 14:12:55 -0400 Subject: [PATCH 2/2] Fix typos and text consistency --- cps/helper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index e6d56bf6..52161ca0 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -884,7 +884,7 @@ def save_cover_from_filestorage(filepath, saved_filename, img): log.error("Failed to create path for cover") return False, _("Failed to create path for cover") try: - # upload of jgp file without wand + # upload of jpg file without wand if isinstance(img, requests.Response): with open(os.path.join(filepath, saved_filename), 'wb') as f: f.write(img.content) @@ -1013,14 +1013,14 @@ def check_unrar(unrar_location): return if not os.path.exists(unrar_location): - return _('Unrar binary file not found') + return _('UnRar binary file not found') try: unrar_location = [unrar_location] value = process_wait(unrar_location, pattern='UNRAR (.*) freeware') if value: version = value.group(1) - log.debug("unrar version %s", version) + log.debug("UnRar version %s", version) except (OSError, UnicodeDecodeError) as err: log.error_or_exception(err) @@ -1065,7 +1065,7 @@ def check_calibre(calibre_location): except (OSError, UnicodeDecodeError) as err: log.error_or_exception(err) - return _('Error excecuting Calibre') + return _('Error executing Calibre') def json_serial(obj):