Commit bd7f6dda authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

Consistently used configured loggers

parent 64959046
......@@ -33,18 +33,19 @@ def _create_logger(name, logfile):
# configure logger:
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
logging_formatter = logging.Formatter('%(asctime)s | %(name)s | %(levelname)s: %(message)s')
logging_streamh = logging.StreamHandler()
logging_streamh.setLevel(logging.ERROR)
logging_streamh.setFormatter(logging_formatter)
formatter = logging.Formatter('%(levelname)s: %(message)s')
logging_fh = logging.FileHandler(logfile)
logging_fh.setLevel(logging.INFO)
logging_fh.setFormatter(logging_formatter)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.ERROR)
console_handler.setFormatter(formatter)
logger.addHandler(logging_streamh)
logger.addHandler(logging_fh)
file_handler = logging.FileHandler(logfile)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.addHandler(file_handler)
return logger
......@@ -64,7 +65,7 @@ def foxml_export(objectstore_path, output_path, recordsets_csv_file):
try:
foxml_reader = FoxmlReader(foxml_path)
except FoxmlParsingError as parsing_error:
logging.error("Error while parsing FOXML file", exc_info=parsing_error)
logger.error("Error while parsing FOXML file", exc_info=parsing_error)
else:
old_record_set_id = foxml_reader.get_recordset_id()
if old_record_set_id is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment