Coder Social home page Coder Social logo

django-slack-logger's Introduction

django-slack-logger

Django errors logs into Slack channel

Installation

Add django-slack-logger to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    ...
    'django-slack-logger',
]

Add Slack Webhook URL in settings.py file

SLACK_WEBHOOK_URL = "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"

By default you will get full error logs in your slack channel, if you want short log details you can set

SLACK_SHORT_MESSAGE = True

You can also set specific error level you want to receive for that you can set

SLACK_ERROR_LEVEL = ["ERROR", "DEBUG", "INFO"] 

by default ["ERROR", "CRITICAL"] for all error level you set "*" or ["*"]

If you want to receive logs in email you can set SLACK_WITH_EMAIL=True ( you need to configuration Django email variables into settings.py with ADMINS ) by default it is False

	EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_PORT = 587
    EMAIL_HOST_USER = '[email protected]'
    EMAIL_HOST_PASSWORD = 'password'
    EMAIL_USE_TLS = True
    ADMINS = [('Your Name', '[email protected]'),]

Creating Slack App

Goto: https://api.slack.com/apps?new_app=1 to create app

 After creating app, In `Add features and functionality` tab click on `Incoming Webhooks` and make it turn on

Slack-Incomming-Webhooks

 Click on `Add New Webhook to Workspace` in new page select channel to post to as an app

Slack-Activate-Webhooks Slack-Channel-to-Post

 Copy `Webhook URL` and add to `SLACK_WEBHOOK_URL`

Slack-Webhooks-Copy

 Error notification 

django-slack-logger's People

Contributors

ashusharma-com avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

amarsree

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.