0.0.4 • Published 1 year ago

rankish v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Documentation

It is mainly used to send alarm information at the Node end, and has the following advantages:

  • Globally unique
  • Merge to send
  • Support silence
  • Easy access
  • Supports alarm rule filtering

Install

npm -i rankish

use

  1. Unlock custom robots in the dingTalk group
  2. The keyword is customized. You can bring the sent content with you
  3. Get access_token
  4. Use the following code
import Notice from 'rankish'
const { ding } = new Notice()
const dinging = ding(
  '4e6add99ad420323a61b0ad4caa4940ec2806670a20ff00d3212300321300321',
  {isAtAll:false},
);
ding.send('begin test');
ding.error('this is error');
ding
  .rules({'userAgent': 'mpcrawler'}, {header: {'user-agent': 'jkfodsjofijmpcrawler'}})
  .error('rule111', 'jkfodsjofijmpcrawler', 'mpcrawler')
ding.warn('this is warn');
ding.log('this is log');

API

  • ding(token, {hoding, silence})

    • token: Webhook 的 access_token
    • hoding:
    • silence:
  • rules(rule, params)

other

function msg2string (msg) {
  if (msg instanceof Error) {
    return msg.stack ? msg.stack : JSON.stringify(msg);
  }

  if (typeof msg === 'object') {
    return JSON.stringify(msg);
  }

  if (typeof msg === 'function') {
    return msg.toString();
  }

  return msg;
}
0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago