winston-telegram
TypeScript icon, indicating that this package has built-in type declarations

2.7.0 • Public • Published

winston-telegram

NPM

A Telegram transport for winston.

Version npm npm Downloads CI Status Coverage Status JavaScript Style Guide

winston-telegram@2

Installation:

$ npm install winston@3
$ npm install winston-telegram@2

Looking for winston-telegram@1.x ?

Documentation below is for winston-telegram@2. Read the winston-telegram@1.x documentation.

Usage

const logger = require('winston')
const TelegramLogger = require('winston-telegram')

// or
import TelegramLogger from 'winston-telegram';

logger.add(new TelegramLogger(options))

Options:

  • token The Telegram bot authentication token. [required]
  • chatId The Telegram chatid you want to send to. [required]
  • messageThreadId The Telegram unique identifier of a message thread to which the message belongs. [optional]
  • parseMode The Telegram mode for parsing entities in the message text. See formatting options for more details. [optional]
  • level Level of messages that this transport should log. [optional] [default info]
  • unique Whether to log only the declared level and none above. [boolean] [optional]
  • silent Whether to suppress output. [boolean] [optional]
  • disableNotification Sends the message silently. [boolean] [optional]
  • template Format output message. [string] [optional]
  • formatMessage Format output message by own method. [function] [optional]
  • handleExceptions Handle uncaught exceptions. [boolean] [optional]
  • batchingDelay Time in ms within which to batch messages together. [integer] [optional] [default 0 or disabled]
  • batchingSeparator String 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 messages

Examples

Follow below steps to run the examples:

$ git clone git@github.com:ivanmarban/winston-telegram.git -b master --single-branch
$ npm install

Replace TELEGRAM_TOKEN and CHAT_ID with appropiate values, then run whatever example you want:

$ node examples/default-logger.js

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.7.01,168latest
1.4.2531.x-latest

Version History

VersionDownloads (Last 7 Days)Published
2.7.01,168
2.6.034
2.5.012
2.4.18
2.4.00
2.3.50
2.3.40
2.3.31
2.3.21
2.3.13
2.3.03
1.4.253
2.2.21
2.2.10
2.2.00
1.4.11
2.1.00
1.4.00
1.3.21
2.0.10
2.0.00
1.3.10
1.3.00
1.2.10
1.2.00
1.1.00
1.0.00
0.4.00
0.3.00
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i winston-telegram

Weekly Downloads

1,286

Version

2.7.0

License

MIT

Unpacked Size

22.2 kB

Total Files

7

Last publish

Collaborators

  • ivanmarban