GithubHelp home page GithubHelp logo

winston-slack-webhook's Introduction

winston-slack-webhook


Installation

  npm install -S winston winston-slack-webhook

Usage

Set up with transports

  var winston = require('winston');
  var SlackWebHook = require('winston-slack-webhook').SlackWebHook;

  var logger = new winston.Logger({
    level: 'info',
    transports: [
      new (winston.transports.Console)(),
      new SlackWebHook({
        level: 'error',
        webhookUrl: 'https://hooks.slack.com/services/xxx/xxx/xxx',
        channel: '#error_logs',
        username: 'logger'
      })
    ]
  });

  logger.info('Created logger');
  logger.error('Something wrong!!');

Set up by adding

  var winston = require('winston');
  var SlackWebHook = require('winston-slack-webhook').SlackWebHook;

  var logger = new winston.Logger();
  logger.add(SlackWebHook, {
    level: 'error',
    webhookUrl: 'https://hooks.slack.com/services/xxx/xxx/xxx',
    channel: '#error_logs',
    username: 'logger'
  });

Options

  • webhookUrl: Slack incoming webhook url (required)
  • channel: Slack channel to post to. (optional 1)
  • username: User name to post as. (optional 1)
  • iconEmoji: Icon to post as. (optional 1)
  • iconUrl: Icon to post as. (either iconEmoji or iconUrl will be used)
  • formatter: Custom function to format logs. (optional)
  • level: Level to log. (global settings will be applied if level is blank)
  • unfurlLinks: Whether to unfurl links in Slack (optional)

Footnotes

  1. Integration settings on slack will be applied if it's blank. 2 3

winston-slack-webhook's People

Contributors

brendonboshell avatar flavionegrao avatar motomux avatar olalonde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

winston-slack-webhook's Issues

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.