Parcourir la source

Logger creation simplified

master
Dirk Alders il y a 2 mois
Parent
révision
c9532aaf37
2 fichiers modifiés avec 3 ajouts et 10 suppressions
  1. 2
    5
      signals.py
  2. 1
    5
      views.py

+ 2
- 5
signals.py Voir le fichier

@@ -1,12 +1,9 @@
1 1
 import logging
2
+from django.conf import settings
2 3
 from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
3 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 9
 @receiver(user_logged_in)

+ 1
- 5
views.py Voir le fichier

@@ -15,11 +15,7 @@ from themes import Context
15 15
 import users
16 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 21
 def password_recovery(request):

Chargement…
Annuler
Enregistrer