Commit d25d792b authored by Guillaume Seguin's avatar Guillaume Seguin

Append filename when log_path is a directory

parent 8da2c253
...@@ -57,6 +57,8 @@ def setup_logging(out, filepath = None, reset_handlers = False): ...@@ -57,6 +57,8 @@ def setup_logging(out, filepath = None, reset_handlers = False):
logging_handler.setFormatter(formatter) logging_handler.setFormatter(formatter)
logger.addHandler(logging_handler) logger.addHandler(logging_handler)
if filepath: if filepath:
if os.path.isdir(filepath):
filepath = os.path.join(filepath, "printrun.log")
formatter = LogFormatter("%(asctime)s - [%(levelname)s] %(message)s", "%(asctime)s - %(message)s") formatter = LogFormatter("%(asctime)s - [%(levelname)s] %(message)s", "%(asctime)s - %(message)s")
logging_handler = logging.FileHandler(filepath) logging_handler = logging.FileHandler(filepath)
logging_handler.setFormatter(formatter) logging_handler.setFormatter(formatter)
......
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