2.6.1 • Published 12 months ago

@hungtranit/winston-telegram v2.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

winston-telegram

NPM

A Telegram transport for winston.

Version npm npm Downloads Tests Status Coverage Status dependencies Status JavaScript Style Guide Donate

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:

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

Publish package

npm init --scope=@hungtranit
npm login
Publish the package:
npm publish