Skip to main content

A Python logging handler for Slack integration

Project description

https://img.shields.io/pypi/pyversions/slack-logger.svg?maxAge=2592000?style=flat-square

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.2.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

slack_logger-0.1.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file slack-logger-0.1.2.tar.gz.

File metadata

File hashes

Hashes for slack-logger-0.1.2.tar.gz
Algorithm Hash digest
SHA256 260c18f9021dc013ea31f365ecb56d7c305ddd7810fcd4062ced7cce889b7068
MD5 119bf5481efdc92cec5f3e4a73349bf0
BLAKE2b-256 68b418facf354763c8031a57f7b127605efa9c5807fc96680dc887acd5f8c35d

See more details on using hashes here.

File details

Details for the file slack_logger-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for slack_logger-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80fbf2b6d55f79bb91b86e318eeffdd905ac1c807d9f3a7d7fae6bd896a44331
MD5 305e3d0371d295341c190514188a4a76
BLAKE2b-256 e51a0ed389471d7089efd3199978c1c1d2632c8f0c0ab18e83997f290195c99f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page