Logging cleanup
This commit is contained in:
parent
aba9b72d2c
commit
e2634f7a50
5 changed files with 15 additions and 13 deletions
|
@ -19,8 +19,6 @@ from . import abstract, parser_factory
|
|||
assert Set
|
||||
assert Pattern
|
||||
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
|
||||
def _parse_xml(full_path: str):
|
||||
""" This function parse XML, with namespace support. """
|
||||
|
||||
|
@ -96,7 +94,8 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
|
|||
if self._specific_cleanup(full_path) is False:
|
||||
shutil.rmtree(temp_folder)
|
||||
os.remove(self.output_filename)
|
||||
logging.info("Something went wrong during deep cleaning of %s", item.filename)
|
||||
logging.warning("Something went wrong during deep cleaning of %s",
|
||||
item.filename)
|
||||
return False
|
||||
|
||||
if item.filename in self.files_to_keep:
|
||||
|
@ -110,7 +109,9 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
|
|||
if not tmp_parser:
|
||||
shutil.rmtree(temp_folder)
|
||||
os.remove(self.output_filename)
|
||||
logging.info("%s's format (%s) isn't supported", item.filename, mtype)
|
||||
logging.error("in file %s, element %s's format (%s) " +
|
||||
"isn't supported",
|
||||
self.filename, item.filename, mtype)
|
||||
return False
|
||||
tmp_parser.remove_all()
|
||||
os.rename(tmp_parser.output_filename, full_path)
|
||||
|
|
|
@ -16,8 +16,6 @@ from gi.repository import Poppler, GLib
|
|||
|
||||
from . import abstract
|
||||
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
|
||||
poppler_version = Poppler.get_version()
|
||||
if LooseVersion(poppler_version) < LooseVersion('0.46'): # pragma: no cover
|
||||
raise ValueError("MAT2 needs at least Poppler version 0.46 to work. \
|
||||
|
|
|
@ -3,9 +3,6 @@ from typing import Union, Tuple, Dict
|
|||
|
||||
from . import abstract
|
||||
|
||||
logging.basicConfig(level=logging.ERROR)
|
||||
|
||||
|
||||
class TorrentParser(abstract.AbstractParser):
|
||||
mimetypes = {'application/x-bittorrent', }
|
||||
whitelist = {b'announce', b'announce-list', b'info'}
|
||||
|
@ -123,9 +120,9 @@ class _BencodeHandler(object):
|
|||
try:
|
||||
ret, trail = self.__decode_func[s[0]](s)
|
||||
except (IndexError, KeyError, ValueError) as e:
|
||||
logging.debug("Not a valid bencoded string: %s", e)
|
||||
logging.warning("Not a valid bencoded string: %s", e)
|
||||
return None
|
||||
if trail != b'':
|
||||
logging.debug("Invalid bencoded value (data after valid prefix)")
|
||||
logging.warning("Invalid bencoded value (data after valid prefix)")
|
||||
return None
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue