Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2d625493

Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)

Hotfix - logpath definition

Zobrazit rozdíly:

src/config/configuration.py
7 7
from injector import singleton, inject
8 8

  
9 9
from src.constants import DEFAULT_CONNECTION_STRING, TEST_DATABASE_FILE, DEFAULT_SERVER_BASE_URL, LOG_NAME, \
10
    LOG_DIR_LOCATION, DEFAULT_LOG_LEVEL
10
    LOG_DIR, DEFAULT_LOG_LEVEL
11 11
from src.constants import LOG_FILE_LOCATION, LOG_FORMAT
12 12
from src.utils.logger import Logger
13 13

  
......
84 84

  
85 85

  
86 86
def configure_logging(config: Configuration):
87
    if not os.path.exists(LOG_DIR_LOCATION.shortest_relative_path()):
88
        os.makedirs(LOG_DIR_LOCATION.shortest_relative_path())
87
    if not os.path.exists(LOG_DIR):
88
        os.makedirs(LOG_DIR)
89 89

  
90 90
    handler = logging.handlers.TimedRotatingFileHandler(
91
        LOG_FILE_LOCATION.shortest_relative_path(),
91
        os.path.join(LOG_DIR, "application.log"),
92 92
        when='H', interval=1)
93 93
    formatter = logging.Formatter(LOG_FORMAT)
94 94
    handler.setFormatter(formatter)
src/constants.py
7 7
DATETIME_FORMAT = "%d.%m.%Y %H:%M:%S"
8 8

  
9 9
LOG_DIR = "logs"
10
LOG_DIR_LOCATION = FileAnchor("aswi2021jmsd", LOG_DIR)
11 10
LOG_FILE = f"{LOG_DIR}/application.log"
12 11
LOG_FILE_LOCATION = FileAnchor("aswi2021jmsd", LOG_FILE)
13 12
LOG_FORMAT = "%(levelname)-8s %(asctime)s - %(message)s"

Také k dispozici: Unified diff