Browse Source

Correct logging formatting in errors/warnings

pull/1502/head
Safihre 5 years ago
parent
commit
9155ade937
  1. 21
      SABnzbd.py
  2. 2
      sabnzbd/interface.py
  3. 5
      sabnzbd/newsunpack.py
  4. 2
      sabnzbd/notifier.py

21
SABnzbd.py

@ -395,14 +395,15 @@ def print_modules():
if sabnzbd.decoder.SABYENC_VERSION:
# We have a VERSION, thus a SABYenc module, but it's not the correct version
logging.error(
T("SABYenc disabled: no correct version found! (Found v%s, expecting v%s)")
% (sabnzbd.decoder.SABYENC_VERSION, sabnzbd.constants.SABYENC_VERSION_REQUIRED)
T("SABYenc disabled: no correct version found! (Found v%s, expecting v%s)"),
sabnzbd.decoder.SABYENC_VERSION,
sabnzbd.constants.SABYENC_VERSION_REQUIRED,
)
else:
# No SABYenc module at all
logging.error(
T("SABYenc module... NOT found! Expecting v%s - https://sabnzbd.org/sabyenc")
% sabnzbd.constants.SABYENC_VERSION_REQUIRED
T("SABYenc module... NOT found! Expecting v%s - https://sabnzbd.org/sabyenc"),
sabnzbd.constants.SABYENC_VERSION_REQUIRED,
)
# Do not allow downloading
sabnzbd.NO_DOWNLOADING = True
@ -419,9 +420,7 @@ def print_modules():
if sabnzbd.newsunpack.MULTIPAR_COMMAND:
logging.info("MultiPar binary... found (%s)", sabnzbd.newsunpack.MULTIPAR_COMMAND)
elif sabnzbd.WIN32:
logging.error(
"%s %s" % (T("MultiPar binary... NOT found!"), T("Verification and repair will not be possible."))
)
logging.error("%s %s", T("MultiPar binary... NOT found!"), T("Verification and repair will not be possible."))
if sabnzbd.newsunpack.RAR_COMMAND:
logging.info("UNRAR binary... found (%s)", sabnzbd.newsunpack.RAR_COMMAND)
@ -430,9 +429,7 @@ def print_modules():
if sabnzbd.newsunpack.RAR_PROBLEM and not sabnzbd.cfg.ignore_wrong_unrar():
have_str = "%.2f" % (float(sabnzbd.newsunpack.RAR_VERSION) / 100)
want_str = "%.2f" % (float(sabnzbd.constants.REC_RAR_VERSION) / 100)
logging.warning(
T("Your UNRAR version is %s, we recommend version %s or higher.<br />") % (have_str, want_str)
)
logging.warning(T("Your UNRAR version is %s, we recommend version %s or higher.<br />"), have_str, want_str)
elif not (sabnzbd.WIN32 or sabnzbd.DARWIN):
logging.info("UNRAR binary version %.2f", (float(sabnzbd.newsunpack.RAR_VERSION) / 100))
else:
@ -1167,8 +1164,8 @@ def main():
logging.warning(
T(
"SABnzbd was started with encoding %s, this should be UTF-8. Expect problems with Unicoded file and directory names in downloads."
)
% sabnzbd.encoding.CODEPAGE
),
sabnzbd.encoding.CODEPAGE,
)
# SSL Information

2
sabnzbd/interface.py

@ -342,7 +342,7 @@ def log_warning_and_ip(txt):
)
else:
txt = "%s %s>%s" % (txt, cherrypy.request.remote.ip, cherrypy.request.headers.get("User-Agent", "??"))
logging.warning("%s", txt)
logging.warning(txt)
##############################################################################

5
sabnzbd/newsunpack.py

@ -46,6 +46,7 @@ from sabnzbd.filesystem import (
recursive_listdir,
setname_from_path,
get_ext,
get_filename,
)
from sabnzbd.sorting import SeriesSorter
import sabnzbd.cfg as cfg
@ -669,7 +670,7 @@ def rar_extract(rarfile_path, numrars, one_folder, nzo, setname, extraction_path
break
if fail == 2:
logging.error("%s (%s)", T("Unpacking failed, archive requires a password"), os.path.split(rarfile_path)[1])
logging.error("%s (%s)", T("Unpacking failed, archive requires a password"), get_filename(rarfile_path))
return fail, new_files, rars
@ -848,7 +849,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction
p.kill()
elif line.startswith("ERROR: "):
msg = T("ERROR: %s" % line[7:])
msg = T("ERROR: %s") % line[7:]
nzo.fail_msg = msg
logging.warning(msg)
nzo.set_unpack_info("Unpack", msg, setname)

2
sabnzbd/notifier.py

@ -360,7 +360,7 @@ def send_nscript(title, msg, gtype, force=False, test=None):
if script_path:
output, ret = external_script(script_path, gtype, title, msg, parameters)
if ret:
logging.error(T('Script returned exit code %s and output "%s"') % (ret, output))
logging.error(T('Script returned exit code %s and output "%s"'), ret, output)
return T('Script returned exit code %s and output "%s"') % (ret, output)
else:
logging.info("Successfully executed notification script " + script_path)

Loading…
Cancel
Save