node-telegram-logger
Telegram Logger Library for nodejs and javascript for debugging your application easier using telegram bots
Screenshot
Installation
Install using npm:
npm i node-telegram-logger@latest --save
Features
- simple wrapper for telegram
- universal which works on nodejs and browser with one simple api
- 8 log levels
- compatible with winston
Usage
const TelegramLogger = let tg = 'token''channelName'tg
- token your bot token provided by BotFather
- channelName your telegram channel userName or simply chat_id
there are 8 level for messages based on their priority you can use on of :
DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
default is set to INFO, also you can use RANDOM
argument to get a random emoji each time
using with winston
first install winston and winston-transport if you don't have already via
npm install winston-transport winston@3.0.0-rc3 --save
const TelegramLogger = let tg = 'TOKEN''@channel'const winston = const logger = winston;logger;
Notes
if your telegram channel is private then you can get your channel id via below method :
Log into Telegram via web: telegram web Find your channel and copy the URL. You should have something like this: https://web.telegram.org/#/im?p=cNUMBERnumber The numbers between "c" and "" are the ID of your private channel.
Now tell your bot to send the messages to chat_id=-100NUMBER
TODO List
- compatiblity with react-native