Package Exports
- node-telegram-log
- node-telegram-log/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-telegram-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Telegram Logger
Simple Telegram logger for node.js.
Install
$ npm install node-telegram-log
Prerequisites
Create telegram bot and get it's
token
:Add bot to group or go to bot's page and
/start
Get
chat_id
where bot will send messages. Feel free to use IDBot to getchat_id
Usage
const { TelegramLogger } = require('node-telegram-log');
const logger = new TelegramLogger(BOT_TOKEN_ID, CHAT_ID);
// Log some message
logger.log('Hooray! It works');
// Formatted message
/**
* ℹ️ LOG
*
* Hooray! It works
*/
// Or debug
logger.debug('Just debugging it', { canILogObjects: true });
// Formatted message
/**
* ⚙️ DEBUG
*
* Just debugging it
* {
* "canILogObjects": true
* }
*/
// Mention user, who must to pay attention to this message
// Note: @mentions work only if part of message starts with @username
logger.error('@joeberetta', 'Something went wrong:', [1, { formatted: true }, 'wow']);
// Formatted message
/**
* 🆘 ERROR
*
* Something went wrong:
* [1,{"formatted":true},"wow"]
*
* @joeberetta
*/
Author
Joe Beretta
License
Copyright © 2020, Joe Beretta. Released under the MIT License.