winston-telegram
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -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){ |
{ | ||
"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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7556
102
83
Updatedrequest@^2.73.0