Giter VIP home page Giter VIP logo

winston-bishop-slack's Introduction

###Winston Transport for Slack chat integration

Basic transport that works just like all other winston transports. Sends logged messages to a specified slack chat channel

First install winston...

$ npm install winston

Then install winston-bishop-slack

$ npm install winston-bishop-slack

#####Additional Options:

  • webhook_url: (required) url for your integration (provided by the slack API)
  • icon_url: avatar of the message 'sender' as it appears in slack
  • channel: channel on which the sent message will appear in slack
  • username: name displayed in the chat channel. default "Winston Bishop"
var winston = require('winston'); var slack = require('winston-bishop-slack').Slack;
winston.add(slack, {
  webhook_url: "https://hooks.slack.com/services/...",
  icon_url: "https://stagefisher.s3.amazonaws.com/images/character/image/519b31da5bf1614f8100000e/Winston-Bishop-New_Girl.jpg",
  channel: "#winston",
  username: "Winston Bishop",
  level: 'error',
  handleExceptions: true,
  customFormatter: function(level, message, meta) {
    return { attachments: [ {
      fallback: "Urgent announcement regarding my cat Ferguson",
      pretext: "Urgent announcement regarding my cat Ferguson",
      color: '#D00000',
      fields: [{
        title: util.format(":scream_cat: %s", message),
        value: meta.detail,
        short: false
      }]
    }]}
  }
})

winston.error('Ferguson Ran Away!', { detail: "He was last seen at 3pm on Tuesday" }, 
  function(err, res) {
    console.log('Finished 3: (error=%s)', JSON.stringify(err, null, 2));
  }
);

winston

winston-bishop-slack's People

Contributors

bdentino avatar sethpollack avatar

Watchers

Trever Faden avatar James Cloos avatar

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.