Browse Source

Logger creation simplified

master
Dirk Alders 2 months ago
parent
commit
c9532aaf37
2 changed files with 3 additions and 10 deletions
  1. 2
    5
      signals.py
  2. 1
    5
      views.py

+ 2
- 5
signals.py View File

1
 import logging
1
 import logging
2
+from django.conf import settings
2
 from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
3
 from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
3
 from django.dispatch import receiver
4
 from django.dispatch import receiver
4
 
5
 
5
-try:
6
-    from config import APP_NAME as ROOT_LOGGER_NAME
7
-except ImportError:
8
-    ROOT_LOGGER_NAME = 'root'
9
-logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
6
+logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__)
10
 
7
 
11
 
8
 
12
 @receiver(user_logged_in)
9
 @receiver(user_logged_in)

+ 1
- 5
views.py View File

15
 import users
15
 import users
16
 from users import parameter
16
 from users import parameter
17
 
17
 
18
-try:
19
-    from config import APP_NAME as ROOT_LOGGER_NAME
20
-except ImportError:
21
-    ROOT_LOGGER_NAME = 'root'
22
-logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
18
+logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__)
23
 
19
 
24
 
20
 
25
 def password_recovery(request):
21
 def password_recovery(request):

Loading…
Cancel
Save