From 6397ca41399fcbb85fd7a821cf1c8bff558f2645 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Thu, 21 Jan 2021 19:39:20 +0100 Subject: [PATCH] Some more Adaption to new logging (as in pygal) --- config_example/config.py | 3 +++ main/settings.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config_example/config.py b/config_example/config.py index add8f68..3f7ae17 100644 --- a/config_example/config.py +++ b/config_example/config.py @@ -2,6 +2,9 @@ # General settings # +# APP_NAME is used for logging +APP_NAME = 'patt' + # SECURITY WARNING: don't run with debug turned on in production! # DEBUG = False diff --git a/main/settings.py b/main/settings.py index 859ba63..1bd4b9a 100644 --- a/main/settings.py +++ b/main/settings.py @@ -17,6 +17,11 @@ import stat import sys import random +try: + from config import APP_NAME as ROOT_LOGGER_NAME +except ImportError: + ROOT_LOGGER_NAME = 'root' + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) # @@ -238,7 +243,7 @@ File "%(pathname)s", line %(lineno)d, in %(funcName)s 'level': 'INFO', 'propagate': False, }, - config.APP_NAME: { + ROOT_LOGGER_NAME: { 'handlers': default_handler, 'level': 'DEBUG' if DEBUG else 'INFO', 'propagate': False,