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

2
sabnzbd/interface.py

@ -342,7 +342,7 @@ def log_warning_and_ip(txt):
) )
else: else:
txt = "%s %s>%s" % (txt, cherrypy.request.remote.ip, cherrypy.request.headers.get("User-Agent", "??")) 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, recursive_listdir,
setname_from_path, setname_from_path,
get_ext, get_ext,
get_filename,
) )
from sabnzbd.sorting import SeriesSorter from sabnzbd.sorting import SeriesSorter
import sabnzbd.cfg as cfg import sabnzbd.cfg as cfg
@ -669,7 +670,7 @@ def rar_extract(rarfile_path, numrars, one_folder, nzo, setname, extraction_path
break break
if fail == 2: 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 return fail, new_files, rars
@ -848,7 +849,7 @@ def rar_extract_core(rarfile_path, numrars, one_folder, nzo, setname, extraction
p.kill() p.kill()
elif line.startswith("ERROR: "): elif line.startswith("ERROR: "):
msg = T("ERROR: %s" % line[7:]) msg = T("ERROR: %s") % line[7:]
nzo.fail_msg = msg nzo.fail_msg = msg
logging.warning(msg) logging.warning(msg)
nzo.set_unpack_info("Unpack", msg, setname) 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: if script_path:
output, ret = external_script(script_path, gtype, title, msg, parameters) output, ret = external_script(script_path, gtype, title, msg, parameters)
if ret: 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) return T('Script returned exit code %s and output "%s"') % (ret, output)
else: else:
logging.info("Successfully executed notification script " + script_path) logging.info("Successfully executed notification script " + script_path)

Loading…
Cancel
Save