An extremely simple logging handler for relaying log events to gotify
Project description
gotify-handler
This repo contains an extremely simple logging handler that relays log events to gotify.
Installation
pip install gotify-handler
Usage
import logging
from gotify_handler import GotifyHandler
logger = logging.getLogger()
logging.basicConfig()
gh = GotifyHandler(server_url="https://gotify.example.com",
app_token="$APP_TOKEN",
alert_on_log_level=logging.WARNING,
extras=None
)
logger.addHandler(gh)
logger.info("Example info (doesn't cause a notification)")
logger.warning("Example warning (causes a notification)")
alert_on_log_level defaults to logging.WARNING, but can be set to any value to make log events trigger notifications on gotify. If the log level is below this value, records are sent to gotify with a priority value of 0. Else, records are sent with a priority value of 5.
extras may optionally be set to a dictionary with the contents of Message Extras that you wish to pass along with all log messages.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gotify_handler-1.0.3.tar.gz.
File metadata
- Download URL: gotify_handler-1.0.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0034bdb2eee27c3b6bb9b569a750acb756313a2bfa8e387741b076bc4b54b0b9
|
|
| MD5 |
6514921be497d6552f612780eb19ab4d
|
|
| BLAKE2b-256 |
76df9bd92654229297dd09c5785d59b3bd85dfbdcce60ccead9917b72b658f0b
|
File details
Details for the file gotify_handler-1.0.3-py3-none-any.whl.
File metadata
- Download URL: gotify_handler-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bc76a945d11225a7f8b3b768e976a659caec99a4a5fb2a94d7ada0e398a2113
|
|
| MD5 |
7d800a9ce0ddf9c2fa458523c13b14ef
|
|
| BLAKE2b-256 |
7a45afa56ca165d21858b077775aa113c2ac446a8b99d2464869f34d462f405b
|