Explorar el Código

Logger creation simplified

master
Dirk Alders hace 2 meses
padre
commit
c9532aaf37
Se han modificado 2 ficheros con 3 adiciones y 10 borrados
  1. 2
    5
      signals.py
  2. 1
    5
      views.py

+ 2
- 5
signals.py Ver fichero

@@ -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 Ver fichero

@@ -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):

Loading…
Cancelar
Guardar