Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston-telegram

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston-telegram - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

10

lib/winston-telegram.js

@@ -28,2 +28,4 @@ /*

this.silent = options.silent || false;
this.disable_notification = options.disable_notification || false;
this.name = options.name || this.name;
};

@@ -41,2 +43,7 @@

/**
* Expose the name of this Transport on the prototype
*/
Telegram.prototype.name = 'telegram';
/**
* Core logging method exposed to Winston.

@@ -60,3 +67,4 @@ * @function log

chat_id : this.chatid,
text : '['+level+'] '+msg
text : '['+level+'] '+msg,
disable_notification : this.disable_notification
}

@@ -63,0 +71,0 @@ }, function(error, response, body){

4

package.json
{
"name": "winston-telegram",
"description": "A Telegram transport for winston",
"version": "0.2.1",
"version": "0.3.0",
"author": "Ivan Marban",

@@ -19,3 +19,3 @@ "repository": {

"dependencies": {
"request": "^2.69.0"
"request": "^2.73.0"
},

@@ -22,0 +22,0 @@ "devDependencies": {

@@ -34,5 +34,51 @@ # winston-telegram

* __silent:__ Whether to suppress output. *[boolean]* *[optional]*
* __disable_notification:__ Sends the message silently. *[boolean]* *[optional]*
## Examples
Using the Default Logger
``` js
var winston = require('winston');
require('winston-telegram').Telegram;
winston.add(winston.transports.Telegram, {
token : 'TELEGRAM_TOKEN',
chatid : 'CHAT_ID',
level : 'error',
unique : true
});
winston.log('error', 'Heeere’s Johnny!');
```
Multiple transports, different chats, different options
``` js
var winston = require('winston');
require('winston-telegram').Telegram;
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Telegram)({
name: 'error-channel',
token : 'TELEGRAM_TOKEN',
chatid : 'CHAT_ID_1',
level : 'error',
unique : true
}),
new (winston.transports.Telegram)({
name: 'info-channel',
token : 'TELEGRAM_TOKEN',
chatid : 'CHAT_ID_2',
level : 'info',
unique : true,
disable_notification: true
})
]
});
logger.error('All work and no play makes Jack a dull boy.');
logger.info('Come play with us, Danny. Forever... and ever... and ever.');
```
[0]: https://telegram.org/
[1]: https://github.com/flatiron/winston
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc