diff options
| author | Nasir Hussain <nasirhjafri@gmail.com> | 2019-02-24 20:10:14 +0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-09-04 08:40:46 +0200 |
| commit | 25706d728536fea88e12f62856de7c4b569ae282 (patch) | |
| tree | 8078a729e666fb72a5c84de8d7fe8a7476ffdccb /docs | |
| parent | 3c6a4fdb6d828a03e368632d88f8261cc30104da (diff) | |
Fixed #29714 -- Allowed using ExceptionReporter subclass with AdminEmailHandler.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/3.0.txt | 8 | ||||
| -rw-r--r-- | docs/topics/logging.txt | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt index 52d435d5d5..9745a34660 100644 --- a/docs/releases/3.0.txt +++ b/docs/releases/3.0.txt @@ -259,6 +259,14 @@ Internationalization language cookies. The default values of these settings preserve the previous behavior. +Logging +~~~~~~~ + +* The new ``reporter_class`` parameter of + :class:`~django.utils.log.AdminEmailHandler` allows providing an + ``django.views.debug.ExceptionReporter`` subclass to customize the traceback + text sent to site :setting:`ADMINS` when :setting:`DEBUG` is ``False``. + Management Commands ~~~~~~~~~~~~~~~~~~~ diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt index 0820451709..ba73234fc1 100644 --- a/docs/topics/logging.txt +++ b/docs/topics/logging.txt @@ -595,7 +595,7 @@ Handlers Django provides one log handler in addition to those provided by the Python logging module. -.. class:: AdminEmailHandler(include_html=False, email_backend=None) +.. class:: AdminEmailHandler(include_html=False, email_backend=None, reporter_class=None) This handler sends an email to the site :setting:`ADMINS` for each log message it receives. @@ -652,6 +652,26 @@ Python logging module. By default, an instance of the email backend specified in :setting:`EMAIL_BACKEND` will be used. + The ``reporter_class`` argument of ``AdminEmailHandler`` allows providing + an ``django.views.debug.ExceptionReporter`` subclass to customize the + traceback text sent in the email body. You provide a string import path to + the class you wish to use, like this: + + .. code-block:: python + + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler', + 'include_html': True, + 'reporter_class': 'somepackage.error_reporter.CustomErrorReporter' + } + }, + + .. versionadded:: 3.0 + + The ``reporter_class`` argument was added. + .. method:: send_mail(subject, message, *args, **kwargs) Sends emails to admin users. To customize this behavior, you can |
