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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file slack_logger-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: slack_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b34fffc217a0a4fa5a06063a11c069660d0d48e71e5b0f03c31bd96f3d1703e7 |
|
MD5 | 04fc87ee3666658a38b77408dbb600ec |
|
BLAKE2b-256 | 3b40ff7e2ee5c70c8202481bcd21c17c8e71e54ce8f628c8eb329e5c172802c1 |