Skip to content

scottmconway/gotify-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An extremely simple logging handler for relaying log events to gotify

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages