Skip to main content
matrix_log_handler
==================

.. image:: https://img.shields.io/pypi/v/matrix_log_handler.svg?style=flat-square
:target: https://pypi.python.org/pypi/matrix_log_handler

.. image:: https://img.shields.io/pypi/wheel/matrix_log_handler.svg?style=flat-square
:target: https://pypi.python.org/pypi/matrix_log_handler

.. image:: https://img.shields.io/pypi/format/matrix_log_handler.svg?style=flat-square
:target: https://pypi.python.org/pypi/matrix_log_handler

.. image:: https://img.shields.io/pypi/pyversions/matrix_log_handler.svg?style=flat-square
:target: https://pypi.python.org/pypi/matrix_log_handler

.. image:: https://img.shields.io/pypi/status/matrix_log_handler.svg?style=flat-square
:target: https://pypi.python.org/pypi/matrix_log_handler

Python log handler that posts to a Matrix room. Posts to the Matrix API using
https://github.com/matrix-org/matrix-python-sdk.

Installation
------------

.. code-block:: bash

pip install matrix-log-handler

Options
-------

base_url (required)
~~~~~~~~~~~~~~~~~~~

The base URL of the Matrix Homeserver to use. Up to, but *not* including `/_matrix/client`.

room_id (required)
~~~~~~~~~~~~~~~~~~

The room ID to use, like !ppfKZfDaaAaWzLkYrw:example.org.

token
~~~~~

An access token that can be used to send messages.

username and password
~~~~~~~~~~~~~~~~~~~~~

An optional username/password to login with. Note that it advised *not* to use these parameters, but use ``token`` instead.

fail_silent
~~~~~~~~~~~
Defaults to ``False``.

If your access token, username/password, or base URL is invalid, or for some other reason the API
call returns an error, this option will silently ignore the API error.

If you enable this setting, **make sure you have another log handler** that will also handle the
same log events, or they may be lost entirely.

Logging configuration
--------------------

This example will send log messages with the level of ERROR or above to Matrix.

.. code-block:: python

import logging

logging.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'matrix-error': {
'class': 'matrix_log_handler.MatrixLogHandler',
'level': 'ERROR',
'base_url': 'https://matrix.example.com',
'room_id': '!ppfKZfDaaAaWzLkYrw:example.org'
},
'loggers': {
'': {
'handlers': ['matrix-error'],
'level': 'ERROR',
'propagate': True,
},
}
}
})

logging.error('Hello, Matrix!')

License
-------

Apache 2.0

Matrix-Python-SDK is also under Apache 2.0.


Metadata

Release files for matrix-log-handler 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matrix-log-handler 0.3.1
File Size Uploaded
matrix_log_handler-0.3.1.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matrix-log-handler 0.3.1
File Interpreter ABI Platform
matrix_log_handler-0.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.9 kB

Release files / matrix_log_handler-0.3.1.tar.gz

Download URL matrix_log_handler-0.3.1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2beda6fbc41ae034c9f17a4be85f617c2abcc644e1faabcf8c6adeb06b983305
BLAKE2b-256 checksum
How to use checksums
a90a03a111f3648b83de725c0b52b1f96e68032696e548216307ff9723836359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release files / matrix_log_handler-0.3.1-py2.py3-none-any.whl

Download URL matrix_log_handler-0.3.1-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3c387e66894a78dca29a3aa45ebae74aefd71044c389057275729ba7e725f639
BLAKE2b-256 checksum
How to use checksums
1e8ca53ab3f4ae7251f83670c1ac34fc12056d7d8efcbcc1733747bcfb98650f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page