0.2.0 • Published 9 years ago

log-notifier v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

log-notifier

version download

simple notifier for logs.

Usage

var Notifier = require('log-notifier');

var notifier = null;

if (mode === 'development') {
    notifier = new Notifier.Logger({
        prefix: 'hostname',
        format: 'lll'
    });
} else {
    if (target === 'hipchat') {
        // hipchat
        notifier = new Notifier.Hipchat({
            "room": "monitor",
            "auth_token": "__auth_token__",
            "room_token": "__room_token__",
            "mention": [
              "@rei"    // for push notification
            ],
            "allow": "error|info",
            "prefix": "api"
        });
    } else if (target === 'slack') {
        notifier = new Notifier.Slack({
            "webhookurl": "__webhookurl__",
            "channel": "#report",
            "mention": [
                "@rei"
            ],
            "allow": "error|info",
            "name": "api",
            "icon": "https://slack.com/img/icons/app-57.png"
        });
    }
}

// use
notifier.log('message');
notifier.info('message');
notifier.warn('message');
notifier.error('message');

Available

LICENSE

log-notifier is licensed under the MIT license.