summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 13:14:17 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-04 13:14:17 +0200
commitccb2ea0ea4d08290f40a52d3f0df366c28fb13c8 (patch)
tree58ba49e2847440603a07fa677f84d8aa919a14f9
parentc4d9dd48edc0080d66d9bc010a9fc6a6df92efdd (diff)
downloadpoezio-ccb2ea0ea4d08290f40a52d3f0df366c28fb13c8.tar.gz
poezio-ccb2ea0ea4d08290f40a52d3f0df366c28fb13c8.tar.bz2
poezio-ccb2ea0ea4d08290f40a52d3f0df366c28fb13c8.tar.xz
poezio-ccb2ea0ea4d08290f40a52d3f0df366c28fb13c8.zip
config: remove check_create_log_dir().
-rw-r--r--poezio/config.py18
-rw-r--r--poezio/poezio.py1
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()