Relied on NullHandler from the logging stdlib module.

This commit is contained in:
Aymeric Augustin 2013-07-01 23:14:44 +02:00
parent 6a0374d037
commit 6c66a41c3d
2 changed files with 4 additions and 12 deletions

View File

@ -6,16 +6,8 @@ from django.core import mail
from django.core.mail import get_connection from django.core.mail import get_connection
from django.views.debug import ExceptionReporter, get_exception_reporter_filter from django.views.debug import ExceptionReporter, get_exception_reporter_filter
# Imports kept for backwards-compatibility in Django 1.7.
# Make sure a NullHandler is available from logging import NullHandler
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
from logging.config import dictConfig from logging.config import dictConfig
getLogger = logging.getLogger getLogger = logging.getLogger
@ -41,7 +33,7 @@ DEFAULT_LOGGING = {
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
}, },
'null': { 'null': {
'class': 'django.utils.log.NullHandler', 'class': 'logging.NullHandler',
}, },
'mail_admins': { 'mail_admins': {
'level': 'ERROR', 'level': 'ERROR',

View File

@ -255,7 +255,7 @@ complex logging setup, configured using :func:`logging.config.dictConfig`::
'handlers': { 'handlers': {
'null': { 'null': {
'level': 'DEBUG', 'level': 'DEBUG',
'class': 'django.utils.log.NullHandler', 'class': 'logging.NullHandler',
}, },
'console':{ 'console':{
'level': 'DEBUG', 'level': 'DEBUG',