A Python logging handler for Slack integration
Project description
Python logging handler for Slack web hook integration with simple configuration.
Installation
pip install slack-logger
Example
Simple
import logging
from slack_logger import SlackHandler, SlackFormatter
sh = SlackHandler('YOUR_WEB_HOOK_URL') # url is like 'https://hooks.slack.com/...'
sh.setFormatter(SlackFormatter())
logging.basicConfig(handlers=[sh])
logging.warning('warn message')
Using logger
import logging
from slack_logger import SlackHandler, SlackFormatter
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
sh = SlackHandler(username='logger', icon_emoji=':robot_face:', url='YOUR_WEB_HOOK_URL')
sh.setLevel(logging.DEBUG)
f = SlackFormatter()
sh.setFormatter(f)
logger.addHandler(sh)
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')
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
slack-logger-0.1.1.tar.gz
(1.7 kB
view details)
Built Distribution
File details
Details for the file slack-logger-0.1.1.tar.gz
.
File metadata
- Download URL: slack-logger-0.1.1.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ed287b6b76dbca8882f0d2ea360924644f1adbefacb9707198244e6bee675ac |
|
MD5 | 8fbf07a69dd4bc689715a5ccf20a00cf |
|
BLAKE2b-256 | 7a1242a2a5bb44cc13d10de5a665323030f305bc89eebb6a113c3468eb963753 |
File details
Details for the file slack_logger-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: slack_logger-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b3a4d8da0cd20c9bae4c22f1cd8df959b7a5980e78db75f12df262ac8957c00 |
|
MD5 | a59fdc5a469ef54352a86928b3c0b444 |
|
BLAKE2b-256 | f0cb2d9591dcd0d1c906cc2ec8249b23fce400fc7297a800ee19e62d3a1eb4cd |