Skip to main content

Python Slack log handler using webhook

Project description

# Python Slack log handler

Simple Python log handler for Slack using Slack webhooks.

# Installation

```sh
$ pip install slack_log_handler
```

## Usage

The only required argument for `SlackLogHandler` is the webhook URL.
You can pass the `channel`, `username`, or a dictionary of `emojis` for each
log level as named arguments.

Sample usage:

```python
import os
import logging
from slack_log_handler import SlackLogHandler

WEBHOOK_URL = os.getenv('SLACK_URL')

slack_handler = SlackLogHandler(WEBHOOK_URL)
slack_handler.setLevel(logging.WARNING)

logger = logging.getLogger(__name__)
logger.addHandler(slack_handler)

logger.error('Oh my god, an error occurred!')
```

## Troubleshooting

On Linux, if you get an error of this kind,

```
SSL: CERTIFICATE_VERIFY_FAILED
```

make sure the `ca-certificates` package (or whatever package your distribution uses instead) is installed.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for slack_log_handler, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size slack_log_handler-0.3.0-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size slack_log_handler-0.3.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page