From b41f2f607423e48ccb0962328ef1def603d3937e Mon Sep 17 00:00:00 2001 From: alemidev Date: Sun, 20 Feb 2022 14:32:52 +0100 Subject: [PATCH] small improvement --- src/treepuncher/helpers.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/treepuncher/helpers.py b/src/treepuncher/helpers.py index 03e2557..b9809a7 100644 --- a/src/treepuncher/helpers.py +++ b/src/treepuncher/helpers.py @@ -8,9 +8,6 @@ def configure_logging(name:str, level=logging.INFO, color:bool = True): import os from logging.handlers import RotatingFileHandler - if not os.path.isdir("debug"): - os.mkdir("debug") - class ColorFormatter(logging.Formatter): def __init__(self, fmt:str): self.fmt : str = fmt @@ -37,11 +34,7 @@ def configure_logging(name:str, level=logging.INFO, color:bool = True): ch.setLevel(logging.DEBUG) # create formatter and add it to the handlers file_formatter = logging.Formatter("[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s", "%b %d %Y %H:%M:%S") - print_formatter : logging.Formatter - if color: - print_formatter = ColorFormatter("> %(message)s") - else: - print_formatter = logging.Formatter("> %(message)s") + print_formatter = ColorFormatter("> %(message)s") if color else logging.Formatter("> %(message)s") fh.setFormatter(file_formatter) ch.setFormatter(print_formatter) # add the handlers to the logger