summaryrefslogtreecommitdiff
path: root/django/utils/log.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2011-03-16 04:13:57 +0000
committerAdrian Holovaty <adrian@holovaty.com>2011-03-16 04:13:57 +0000
commit304a50d8cac1d185685d212867a2d449c5378e9e (patch)
tree6c34bbec041bec75e3e957a8ce3438600b39f652 /django/utils/log.py
parent2ee7cfcf1c671681e46b685f268797d175ecff20 (diff)
Fixed #15603 -- Changed the traceback error e-mails not to use HTML by default. It's now configurable with an 'include_html' parameter to AdminEmailHandler. Thanks, kmtracey
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/log.py')
-rw-r--r--django/utils/log.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/utils/log.py b/django/utils/log.py
index 784035b3cf..763e667c57 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -48,7 +48,11 @@ if not logger.handlers:
logger.addHandler(NullHandler())
class AdminEmailHandler(logging.Handler):
- """An exception log handler that emails log entries to site admins
+ def __init__(self, include_html=False):
+ logging.Handler.__init__(self)
+ self.include_html = include_html
+
+ """An exception log handler that e-mails log entries to site admins.
If the request is passed as the first argument to the log record,
request data will be provided in the
@@ -88,6 +92,6 @@ class AdminEmailHandler(logging.Handler):
message = "%s\n\n%s" % (stack_trace, request_repr)
reporter = ExceptionReporter(request, is_email=True, *exc_info)
- html_message = reporter.get_traceback_html()
+ html_message = self.include_html and reporter.get_traceback_html() or None
mail.mail_admins(subject, message, fail_silently=True,
html_message=html_message)