Files
trents_blog/docs/posts/sendxmpp-handler-for-python-logging.md
2021-09-10 20:26:47 -07:00

1.3 KiB

title, date, draft, tags, authors, post
title date draft tags authors post
SENDXMPPHandler for Python Logging 2020-12-19 false
Python
Logging
Flask
XMPP
SENDXMPP
logging.Handler
trent
15

date: 2020-12-19

SENDXMPPHandler for Python Logging

<script src="https://gist.github.com/adc541a6245d55e39edd10dab1001a88.js?file= SENDXMPPHandler.md"></script>

app/_init_.py

You may be familiar with adding a logging handler to a flask application, with something like the following in __init__.py.

<script src="https://gist.github.com/adc541a6245d55e39edd10dab1001a88.js?file=__init__.py"></script>

app/sendxmpp_handler.py

python-logging doesn't have a handler for xmpp but the handlers that are available are easy enough to understand if you read through them in handlers.py{target=_blank}.

Using the available handlers as an example, it did not require a lot of imagination to come up with SENDXMPPHandler.

<script src="https://gist.github.com/adc541a6245d55e39edd10dab1001a88.js?file= sendxmpp_handler.py"></script>

Android Yaxim Screenshot

And this is what a flask logging error looks like on Android, in Yaxim. Yaxim Android Screenshot