Skip to main content

Logging handler to send messages to a Slack channel.

Project description

PyPi Code style License Versions CodeFactor

Simple logging with Slack

It helps you to receive all logs from your Python code in Slack channels using webhooks.

Install from PyPi:
pip install simple-slack-logger

or from repository:
pip install git+https://github.com/gixproject/simple-slack-logger

Usage

Explicit usage

import logging
from slack_logger import SlackHandler

logger = logging.getLogger(__name__)
handler = SlackHandler(webhook="<YOUR_WEBHOOK>")
logger.addHandler(handler)
logger.error("Something bad happened")

Logging config

"handlers": {
    "slack": {
        "class": "slack_logger.SlackHandler",
        "formatter": "default",
        "level": "WARNING",
        "webhook": "<YOUR_WEBHOOK>",
    },
}

Hint

To catch all exceptions from your Python code you can use this in the main module:

def logging_except_hook(exc_type, exc_value, exc_traceback):
    logging.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))


sys.excepthook = logging_except_hook

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

simple-slack-logger-0.6.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_slack_logger-0.6.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file simple-slack-logger-0.6.1.tar.gz.

File metadata

  • Download URL: simple-slack-logger-0.6.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-41-generic

File hashes

Hashes for simple-slack-logger-0.6.1.tar.gz
Algorithm Hash digest
SHA256 d0161822a8decda055534bcef8e67fa7d4c89a78ee056df9544bd79768540bc4
MD5 0e29ba3e4d129157e74048a71c6f414d
BLAKE2b-256 7a0da30990b2a3c4bd1d39fb881947ab09d37a352513ffcfdb9e564133ac3146

See more details on using hashes here.

File details

Details for the file simple_slack_logger-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: simple_slack_logger-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-41-generic

File hashes

Hashes for simple_slack_logger-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80cb5165fe858763f0dc072df0354073429e1d3c8e6b2dfffdda8d01836054b0
MD5 28387ed744042475e10c322cd45106ef
BLAKE2b-256 3a3554bb12c44749c87bd3d7e4a0e0aead7ac3ba41161e91113338998cc0c765

See more details on using hashes here.

Supported by

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