summaryrefslogtreecommitdiff
path: root/libmat2/office.py
diff options
context:
space:
mode:
authordkg2018-09-01 05:14:32 -0700
committerjvoisin2018-09-01 05:14:32 -0700
commite2634f7a5052f0507b245b30e2f2bc25963f863f (patch)
treeec8b62ae6a726751f34e74efbce7afbbc3ccc5ef /libmat2/office.py
parentaba9b72d2c9defc253f954d30dfeb3ae3e46d2cc (diff)
Logging cleanup
Diffstat (limited to 'libmat2/office.py')
-rw-r--r--libmat2/office.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/libmat2/office.py b/libmat2/office.py
index 62d0395..4881253 100644
--- a/libmat2/office.py
+++ b/libmat2/office.py
@@ -19,8 +19,6 @@ from . import abstract, parser_factory
19assert Set 19assert Set
20assert Pattern 20assert Pattern
21 21
22logging.basicConfig(level=logging.ERROR)
23
24def _parse_xml(full_path: str): 22def _parse_xml(full_path: str):
25 """ This function parse XML, with namespace support. """ 23 """ This function parse XML, with namespace support. """
26 24
@@ -96,7 +94,8 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
96 if self._specific_cleanup(full_path) is False: 94 if self._specific_cleanup(full_path) is False:
97 shutil.rmtree(temp_folder) 95 shutil.rmtree(temp_folder)
98 os.remove(self.output_filename) 96 os.remove(self.output_filename)
99 logging.info("Something went wrong during deep cleaning of %s", item.filename) 97 logging.warning("Something went wrong during deep cleaning of %s",
98 item.filename)
100 return False 99 return False
101 100
102 if item.filename in self.files_to_keep: 101 if item.filename in self.files_to_keep:
@@ -110,7 +109,9 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
110 if not tmp_parser: 109 if not tmp_parser:
111 shutil.rmtree(temp_folder) 110 shutil.rmtree(temp_folder)
112 os.remove(self.output_filename) 111 os.remove(self.output_filename)
113 logging.info("%s's format (%s) isn't supported", item.filename, mtype) 112 logging.error("in file %s, element %s's format (%s) " +
113 "isn't supported",
114 self.filename, item.filename, mtype)
114 return False 115 return False
115 tmp_parser.remove_all() 116 tmp_parser.remove_all()
116 os.rename(tmp_parser.output_filename, full_path) 117 os.rename(tmp_parser.output_filename, full_path)