winston-telegram
Advanced tools
Comparing version 2.3.5 to 2.4.0
@@ -10,2 +10,6 @@ # Changelog | ||
## [v2.4.0] - 2021-09-25 | ||
### Added | ||
- [#27](https://github.com/ivanmarban/winston-telegram/pull/27) Pass full data argument to `formatMessage` method. | ||
## [v2.3.5] - 2021-05-23 | ||
@@ -136,3 +140,4 @@ ### Changed | ||
[unreleased]: https://github.com/ivanmarban/winston-telegram/compare/v2.3.5...develop | ||
[unreleased]: https://github.com/ivanmarban/winston-telegram/compare/v2.4.0...develop | ||
[v2.4.0]: https://github.com/ivanmarban/winston-telegram/compare/v2.3.5...v2.4.0 | ||
[v2.3.5]: https://github.com/ivanmarban/winston-telegram/compare/v2.3.4...v2.3.5 | ||
@@ -139,0 +144,0 @@ [v2.3.4]: https://github.com/ivanmarban/winston-telegram/compare/v2.3.3...v2.3.4 |
@@ -28,3 +28,3 @@ import TransportStream = require("winston-transport") | ||
/** Format output message by own method. */ | ||
formatMessage?: (params: WinstonTelegram.FormatOptions) => string | ||
formatMessage?: (params: WinstonTelegram.FormatOptions, info: any) => string | ||
/** Handle uncaught exceptions. (default true) */ | ||
@@ -31,0 +31,0 @@ handleExceptions?: boolean |
@@ -78,3 +78,3 @@ /* | ||
if (this.formatMessage) { | ||
messageText = this.formatMessage(formatOptions) | ||
messageText = this.formatMessage(formatOptions, info) | ||
} else { | ||
@@ -81,0 +81,0 @@ messageText = format(this.template, formatOptions) |
{ | ||
"name": "winston-telegram", | ||
"description": "A Telegram transport for winston", | ||
"version": "2.3.5", | ||
"version": "2.4.0", | ||
"author": "Ivan Marban", | ||
@@ -22,3 +22,3 @@ "repository": { | ||
"dependencies": { | ||
"sf": "^0.2.0", | ||
"sf": "^0.1.9", | ||
"winston-transport": "^4.3.0" | ||
@@ -36,17 +36,17 @@ }, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.1.0", | ||
"eslint": "^7.13.0", | ||
"eslint-config-standard": "^16.0.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^32.3.0", | ||
"eslint-plugin-mocha": "^8.0.0", | ||
"chai": "^4.3.4", | ||
"coveralls": "^3.1.1", | ||
"eslint": "^7.32.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-jsdoc": "^36.1.0", | ||
"eslint-plugin-mocha": "^9.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"mocha": "^8.2.1", | ||
"nock": "^13.0.4", | ||
"mocha": "^9.1.1", | ||
"nock": "^13.1.3", | ||
"nyc": "^15.1.0", | ||
"prettier-standard": "^16.4.1", | ||
"sinon": "^10.0.0", | ||
"prettier-standard": "^15.0.1", | ||
"sinon": "^11.1.2", | ||
"winston": "^3.0.0" | ||
@@ -57,6 +57,4 @@ }, | ||
"format": "prettier-standard 'lib/**/*.js' 'test/**/*.js' 'examples/**/*.js'", | ||
"test": "nyc mocha", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"test:coverage": "nyc --reporter=text --reporter=html mocha" | ||
"test": "nyc --reporter=text --reporter=html --reporter=lcovonly mocha" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # winston-telegram | ||
[![npm Downloads](https://img.shields.io/npm/dw/winston-telegram.svg)](https://npmcharts.com/compare/winston-telegram?minimal=true) | ||
[![Build Status](https://travis-ci.org/ivanmarban/winston-telegram.svg?branch=master)](https://travis-ci.org/ivanmarban/winston-telegram) | ||
[![Tests Status](https://github.com/ivanmarban/winston-telegram/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/ivanmarban/winston-telegram/actions/workflows/tests.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/ivanmarban/winston-telegram/badge.svg?branch=master)](https://coveralls.io/github/ivanmarban/winston-telegram?branch=master) | ||
@@ -12,0 +12,0 @@ [![dependencies Status](https://david-dm.org/ivanmarban/winston-telegram/status.svg)](https://david-dm.org/ivanmarban/winston-telegram) |
@@ -214,7 +214,13 @@ const should = require('chai').should() | ||
level: 'error', | ||
formatMessage: function (options) { | ||
formatMessage: function (options, info) { | ||
let message = options.message | ||
if (options.level === 'error') { | ||
message = '[Error] ' + message | ||
} | ||
if (info.superUrgent) { | ||
message += '!!!' | ||
} | ||
return message | ||
@@ -224,4 +230,4 @@ } | ||
) | ||
winston.error('Some error!!') | ||
assert.strictEqual(JSON.parse(spy.getCalls()[0].args[1]).text, '[Error] Some error!!') | ||
winston.error('Some error', { superUrgent: true }) | ||
assert.strictEqual(JSON.parse(spy.getCalls()[0].args[1]).text, '[Error] Some error!!!') | ||
assert.ok(spy.callCount === 1) | ||
@@ -228,0 +234,0 @@ done() |
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
36603
18
624
+ Addedinherits@2.0.1(transitive)
+ Addedsf@0.1.9(transitive)
+ Addedutil@0.10.3(transitive)
- Removedalign-text@0.1.4(transitive)
- Removedany@1.0.0(transitive)
- Removedarr-diff@1.1.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-map@2.0.2(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-each@0.1.1(transitive)
- Removedarray-slice@0.2.3(transitive)
- Removedarray-unique@0.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedexport-dirs@0.2.4(transitive)
- Removedexport-files@2.1.1(transitive)
- Removedfor-in@0.1.81.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedhas-values@0.1.4(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-number@2.1.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedisobject@1.0.23.0.1(transitive)
- Removedkind-of@2.0.13.2.26.0.3(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedmake-iterator@0.1.10.2.11.0.1(transitive)
- Removedobject.defaults@0.3.0(transitive)
- Removedobject.filter@0.3.0(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedobject.reduce@0.1.7(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsf@0.2.0(transitive)
- Removedstriptags@2.2.1(transitive)
- Removedutils@0.3.1(transitive)
- Removedword-wrap@1.2.5(transitive)
Updatedsf@^0.1.9