Python logging handler which posts to slack
Project description
This package provides a logging.Handler that will send message to a slack channel. Supports updated slack.WebClient API released in 2019.
Limitations
How often messages can be sent is limited by slack. See https://api.slack.com/docs/rate-limits. By default, this handler only sends accumulated messages every 60 seconds. That can be adjusted by the optional update argument to SlackHandler.
Example
from nmrbox_slack.slacklogger import SlackHandler token = 'your token here' channel = 'your channel name' handler = SlackHandler(token, channel) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) example_logger = logging.getLogger("Test Logger") example_logger.propagate = False example_logger.addHandler(handler) example_logger.setLevel(logging.INFO) example_logger.info("Then shalt thou use Python three, no more, no less.") ... # at end of program handler.send_remaining()
Funding acknowledgment
This work supported by National Institutes of Health (NIH) / National Institute of General Medical Sciences (NIGMS), grant 1P41GM111135.
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
Close
Hashes for slack-webclient-logger-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74da739fcdb58520e979bd5a825487996e53848efcda6ef5deae925489537cf3 |
|
MD5 | 12ef23a4e3537865104cd49b3824ef19 |
|
BLAKE2b-256 | a6977219d8c05b6c6cbfd207b8db174dc8a7c5a52246e1773d588ffc9a3daf13 |
Close
Hashes for slack_webclient_logger-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bcbcc6110da59a16c41dee16c7f4f6b6a9fe32c8fa63f2a74db48d398e83ae9 |
|
MD5 | bd226f2d3f3ba18e4f1ec57516a2896f |
|
BLAKE2b-256 | ed64ac953949d7fabb6744a95d1ce5a51edf48826acfb059327629d2226c451c |