Giter Club home page Giter Club logo

slack-notifier's Introduction

Build Status

Solita Slack Notifier

Easy AF API to send Slack room notifications & log4net appender.

  1. Select the channel to notify
  2. Select "+ Add an app or custom integration"
  3. Search and select "Incoming WebHooks"
  4. Click "Add Configuration"
  5. Ensure the channel is correct
  6. Click "Add Incoming WebHooks integration"
  7. "Webhook URL" is value for SlackEndpointUrl

Log4net appender

Simple log4net.config example

<?xml version="1.0" encoding="utf-8"?>
<log4net>

  <!-- Custom Slack appender -->
  <appender name="SlackAppender" type="Solita.Slack.Notifier.Log4net.SlackAppender">
   <!-- Use this to indicate project and environment -->
    <slackSender>XXX PROD-01</slackSender>
    <!-- Endpoint url for the integration -->
    <slackEndpointUrl>https://hooks.slack.com/services/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</slackEndpointUrl>
  </appender>
  
  <!-- Custom Slack logger -->
  <logger name="SlackLogger" additivity="false">
    <level value="ALL" />
    <appender-ref ref="SlackAppender" />
  </logger>
  
</log4net>

Code example

        private static readonly ILog SlackLogger = LogManager.GetLogger("SlackLogger");

        private static void Index()
        {
            SlackLogger.Debug("Meikäläisen aikataulu on sellainen, että ikinä ei olla myöhässä mistään");
            SlackLogger.Info("Ennen oli poliisit sentään poliiseja ja laivat rautaa. Nyt on poliisit peltiä ja laivat mitä lie lasikuitua.");
            SlackLogger.Warn("En suosittele antabusta kenellekään. Sen kanssa ryypätessä tulee ihan kammottava olo.");
            SlackLogger.Error("Kun ihminen nukkuu, sille ei tapahdu mitään. Mutta kun se ei nuku, se voi saada vaikka kalan.");
            SlackLogger.Fatal("Kivitettiinhän Jeesustakin aikanaan, mutta nyt mies on maailman maineessa.");
        }

Slack room sample

Slack room sample

Without Log4net

You can use SlackNotifier directly. See Test cases for details.

slack-notifier's People

Contributors

solita-yusuftiryaki avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

solita-reddy

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.