debug log mime type #176

This commit is contained in:
jonaswinkler 2020-12-23 15:22:28 +01:00
parent 46b0776714
commit cffe9fa354

View File

@ -95,19 +95,20 @@ class Consumer(LoggingMixin):
self.pre_check_directories()
self.pre_check_duplicate()
self.log("info", "Consuming {}".format(self.filename))
self.log("info", f"Consuming {self.filename}")
# Determine the parser class.
mime_type = magic.from_file(self.path, mime=True)
self.log("debug", f"Detected mime type: {mime_type}")
parser_class = get_parser_class_for_mime_type(mime_type)
if not parser_class:
raise ConsumerError(f"No parsers available for {self.filename}")
else:
self.log("debug",
f"Parser: {parser_class.__name__} "
f"based on mime type {mime_type}")
f"Parser: {parser_class.__name__}")
# Notify all listeners that we're going to do some work.