Format exception emails better
This commit is contained in:
@@ -41,7 +41,7 @@ class FlaskMailHTMLFormatter(logging.Formatter):
|
|||||||
formatted_exception = logging.Handler.formatException(self, exc_info)
|
formatted_exception = logging.Handler.formatException(self, exc_info)
|
||||||
return FlaskMailHTMLFormatter.pre_template % ("Exception information", formatted_exception)
|
return FlaskMailHTMLFormatter.pre_template % ("Exception information", formatted_exception)
|
||||||
def formatStack(self, stack_info):
|
def formatStack(self, stack_info):
|
||||||
return FlaskMailHTMLFormatter.pre_template % ("<h1>Stack information</h1><pre>%s</pre>", stack_info)
|
return FlaskMailHTMLFormatter.pre_template % ("<h1>Stack information</h1><pre><code>%s</code></pre>", stack_info)
|
||||||
|
|
||||||
|
|
||||||
# see: https://github.com/python/cpython/blob/3.6/Lib/logging/__init__.py (class Handler)
|
# see: https://github.com/python/cpython/blob/3.6/Lib/logging/__init__.py (class Handler)
|
||||||
@@ -100,7 +100,7 @@ Message:
|
|||||||
<tr> <th>Time:</th><td>%(asctime)s</td></tr>
|
<tr> <th>Time:</th><td>%(asctime)s</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h2>Message</h2>
|
<h2>Message</h2>
|
||||||
<pre>%(message)s</pre>"""
|
<pre><code>%(message)s</code></pre>"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
mail_handler = FlaskMailHandler(mailer, subject_template)
|
mail_handler = FlaskMailHandler(mailer, subject_template)
|
||||||
|
|||||||
Reference in New Issue
Block a user