winston-telegram
v2.7.0
Published
A Telegram transport for winston
Downloads
4,772
Maintainers
Readme
winston-telegram
A Telegram transport for winston.
winston-telegram@2
Installation:
$ npm install winston@3
$ npm install winston-telegram@2Looking for [email protected] ?
Documentation below is for winston-telegram@2. Read the [email protected] documentation.
Usage
const logger = require('winston')
const TelegramLogger = require('winston-telegram')
// or
import TelegramLogger from 'winston-telegram';
logger.add(new TelegramLogger(options))Options:
tokenThe Telegram bot authentication token. [required]chatIdThe Telegram chatid you want to send to. [required]messageThreadIdThe Telegram unique identifier of a message thread to which the message belongs. [optional]parseModeThe Telegram mode for parsing entities in the message text. See formatting options for more details. [optional]levelLevel of messages that this transport should log. [optional] [default info]uniqueWhether to log only the declared level and none above. [boolean] [optional]silentWhether to suppress output. [boolean] [optional]disableNotificationSends the message silently. [boolean] [optional]templateFormat output message. [string] [optional]formatMessageFormat output message by own method. [function] [optional]handleExceptionsHandle uncaught exceptions. [boolean] [optional]batchingDelayTime in ms within which to batch messages together. [integer] [optional] [default 0 or disabled]batchingSeparatorString with which to join batched messages with [string] [default "\n\n"]
String template is based on named arguments:
'{level}' -> level of messages
'{message}' -> text of messages
'{metadata}' -> metadata object of messagesExamples
Follow below steps to run the examples:
$ git clone [email protected]:ivanmarban/winston-telegram.git -b master --single-branch
$ npm installReplace TELEGRAM_TOKEN and CHAT_ID with appropiate values, then run whatever example you want:
$ node examples/default-logger.js
