From ccb2ea0ea4d08290f40a52d3f0df366c28fb13c8 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 4 Jul 2018 13:14:17 +0200 Subject: config: remove check_create_log_dir(). --- poezio/config.py | 18 ++++-------------- poezio/poezio.py | 1 - 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/poezio/config.py b/poezio/config.py index 0bb18beb..0c7eaf96 100644 --- a/poezio/config.py +++ b/poezio/config.py @@ -19,7 +19,7 @@ import sys import pkg_resources from configparser import RawConfigParser, NoOptionError, NoSectionError -from os import environ, makedirs, path, remove +from os import path, remove from shutil import copy2 from pathlib import Path from poezio.args import parse_args @@ -591,27 +591,17 @@ def create_global_config(): sys.exit(1) -def check_create_log_dir(): - "Create the poezio logging directory if it doesn’t exist" +def setup_logging(): + "Change the logging config according to the cmdline options and config" global LOG_DIR - LOG_DIR = config.get('log_dir') LOG_DIR = Path(LOG_DIR).expanduser() if LOG_DIR else xdg.DATA_HOME / 'logs' - - try: - makedirs(LOG_DIR) - except: - pass - - -def setup_logging(): - "Change the logging config according to the cmdline options and config" if config.get('log_errors'): LOGGING_CONFIG['root']['handlers'].append('error') LOGGING_CONFIG['handlers']['error'] = { 'level': 'ERROR', 'class': 'logging.FileHandler', - 'filename': path.join(LOG_DIR, 'errors.log'), + 'filename': LOG_DIR / 'errors.log', 'formatter': 'simple', } logging.disable(logging.WARNING) diff --git a/poezio/poezio.py b/poezio/poezio.py index 0b16b6cd..58a8a4d2 100644 --- a/poezio/poezio.py +++ b/poezio/poezio.py @@ -79,7 +79,6 @@ def main(): from poezio import config config.run_cmdline_args() config.create_global_config() - config.check_create_log_dir() config.setup_logging() config.post_logging_setup() -- cgit v1.2.3