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.

Source Distribution

slack_log_handler-0.3.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

slack_log_handler-0.3.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file slack_log_handler-0.3.0.tar.gz.

File metadata

File hashes

Hashes for slack_log_handler-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d21f047706bb1c842be41eafe6366883f37df7c114a9d00e4fc1b688fa822ddb
MD5 5d86097695697de805c4ba56387d7cd0
BLAKE2b-256 9c6fe7771a47f19909bf767dc7f2e072d32563d4710134c4a9e3b54af0242d5c

See more details on using hashes here.

File details

Details for the file slack_log_handler-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for slack_log_handler-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cd785150472f05bea52958b0fc7507324407074f9d408b9850a725426c27ffe
MD5 c26c3ad67a2508516cc4a8890504789b
BLAKE2b-256 4e2d0ff115568d6aaabcd1a5385774e41cbecff607829cb6f965f32e3f3f914d

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