From 6c66a41c3dc697dc3bda4e31e8b05084d2ede915 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Mon, 1 Jul 2013 23:14:44 +0200 Subject: [PATCH] Relied on NullHandler from the logging stdlib module. --- django/utils/log.py | 14 +++----------- docs/topics/logging.txt | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/django/utils/log.py b/django/utils/log.py index cb33378c07..f1af7a249e 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -6,16 +6,8 @@ from django.core import mail from django.core.mail import get_connection from django.views.debug import ExceptionReporter, get_exception_reporter_filter - -# Make sure a NullHandler is available -# 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 - +# Imports kept for backwards-compatibility in Django 1.7. +from logging import NullHandler from logging.config import dictConfig getLogger = logging.getLogger @@ -41,7 +33,7 @@ DEFAULT_LOGGING = { 'class': 'logging.StreamHandler', }, 'null': { - 'class': 'django.utils.log.NullHandler', + 'class': 'logging.NullHandler', }, 'mail_admins': { 'level': 'ERROR', diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt index e2e68a61a1..66c517d615 100644 --- a/docs/topics/logging.txt +++ b/docs/topics/logging.txt @@ -255,7 +255,7 @@ complex logging setup, configured using :func:`logging.config.dictConfig`:: 'handlers': { 'null': { 'level': 'DEBUG', - 'class': 'django.utils.log.NullHandler', + 'class': 'logging.NullHandler', }, 'console':{ 'level': 'DEBUG',