3.0.2 • Published 10 months ago

logger-for-yc-functions-with-tg-alert v3.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

logger-for-yc-functions-with-tg-alert

Logger that uses Yandex Cloud Logging levels and allows you to send notifications to Telegram, without dependencies.

Installation

npm install logger-for-yc-functions-with-tg-alert

Usage

const log = require('logger-for-yc-functions-with-tg-alert')({
  runtime: 'local',
  level: 'debug',
  header: 'Telegram message header',
  chatId: -1001234567890,
  botToken: "1234567890:DSfgfgweg43t34gegss34hu54u533gerg",
  extra: {
    parse_mode: 'HTML',
  },
});

const error = new Error('error');

log.debug('debug', 'label');
log.debug({ id: 1 }, 'label');
log.info('info', 'label');
log.warn('warn', 'label');
log.error('<error>&</error>', 'label');
log.error(error, 'label');
log.fatal('fatal', 'label');
log.trace('trace', 'label');
log.sendToTg('<code>&</code>', 'label');
log.sendToTg({ id: 1 }, 'label');
log.sendToTg(error, 'label');
log.sendToTg(14214, 'label');
  • if runtime = 'local' is set, then the message will be formatted for output to the terminal
  • extra - parameters for Telegram method sendMessage
3.0.2

10 months ago

3.0.1

10 months ago

3.0.0

10 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago