winston-aws-cloudwatch
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -31,6 +31,2 @@ 'use strict'; | ||
var _libQueue = require('./lib/Queue'); | ||
var _libQueue2 = _interopRequireDefault(_libQueue); | ||
var CloudWatchTransport = (function (_Transport) { | ||
@@ -47,3 +43,2 @@ _inherits(CloudWatchTransport, _Transport); | ||
_get(Object.getPrototypeOf(CloudWatchTransport.prototype), 'constructor', this).call(this); | ||
this._queue = new _libQueue2['default'](); | ||
var client = new _libCloudWatchClient2['default'](logGroupName, logStreamName, { awsConfig: awsConfig }); | ||
@@ -54,3 +49,3 @@ var relay = new _libRelay2['default'](client); | ||
}); | ||
relay.start(this._queue); | ||
this._queue = relay.start(); | ||
} | ||
@@ -57,0 +52,0 @@ |
@@ -31,2 +31,6 @@ 'use strict'; | ||
var _CloudWatchEventFormatter = require('./CloudWatchEventFormatter'); | ||
var _CloudWatchEventFormatter2 = _interopRequireDefault(_CloudWatchEventFormatter); | ||
var debug = (0, _debug3['default'])('winston-aws-cloudwatch/CloudWatchClient'); | ||
@@ -70,3 +74,3 @@ | ||
logStreamName: this._logStreamName, | ||
logEvents: batch.map(CloudWatchClient._toCloudWatchEvent), | ||
logEvents: batch.map(_CloudWatchEventFormatter2['default'].formatLogItem), | ||
sequenceToken: sequenceToken | ||
@@ -124,16 +128,2 @@ }; | ||
} | ||
}], [{ | ||
key: '_toCloudWatchEvent', | ||
value: function _toCloudWatchEvent(item) { | ||
return { | ||
message: CloudWatchClient._toCloudWatchMessage(item), | ||
timestamp: item.date | ||
}; | ||
} | ||
}, { | ||
key: '_toCloudWatchMessage', | ||
value: function _toCloudWatchMessage(item) { | ||
var meta = (0, _lodash.isEmpty)(item.meta) ? '' : ' ' + JSON.stringify(item.meta, null, 2); | ||
return '[' + item.level.toUpperCase() + '] ' + item.message + meta; | ||
} | ||
}]); | ||
@@ -140,0 +130,0 @@ |
@@ -33,2 +33,6 @@ 'use strict'; | ||
var _Queue = require('./Queue'); | ||
var _Queue2 = _interopRequireDefault(_Queue); | ||
var _events = require('events'); | ||
@@ -51,2 +55,4 @@ | ||
}); | ||
this._limiter = null; | ||
this._queue = null; | ||
} | ||
@@ -56,16 +62,17 @@ | ||
key: 'start', | ||
value: function start(queue) { | ||
value: function start() { | ||
var _this = this; | ||
debug('start', { queue: queue }); | ||
debug('start'); | ||
if (this._queue) { | ||
throw new Error('Already started'); | ||
} | ||
this._queue = queue; | ||
this._limiter = new _bottleneck2['default'](1, this._options.submissionInterval, 1); | ||
// Initial call to postpone first submission | ||
this._scheduleSubmission(); | ||
this._queue = new _Queue2['default'](); | ||
this._queue.on('push', function () { | ||
return _this._scheduleSubmission(); | ||
}); | ||
// Initial call to postpone first submission | ||
this._scheduleSubmission(); | ||
return this._queue; | ||
} | ||
@@ -77,2 +84,3 @@ }, { | ||
debug('scheduleSubmission'); | ||
this._limiter.schedule(function () { | ||
@@ -92,5 +100,6 @@ return _this2._submit(); | ||
var batch = this._queue.head(this._options.batchSize); | ||
debug('submit: submitting ' + batch.length + ' item(s)'); | ||
var num = batch.length; | ||
debug('submit: submitting ' + num + ' item(s)'); | ||
return this._client.submit(batch).then(function () { | ||
return _this3._onSubmitted(batch.length); | ||
return _this3._onSubmitted(num); | ||
}, function (err) { | ||
@@ -97,0 +106,0 @@ return _this3._onError(err); |
{ | ||
"name": "winston-aws-cloudwatch", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A Winston transport for Amazon CloudWatch.", | ||
@@ -31,9 +31,19 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel": "^5.5.6", | ||
"chai": "^3.0.0", | ||
"chai-as-promised": "^5.1.0", | ||
"del": "^1.2.0", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^5.1.0", | ||
"gulp-babel": "^5.2.0", | ||
"gulp-coveralls": "^0.1.4", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-load-plugins": "^0.10.0", | ||
"gulp-mocha": "^2.1.3", | ||
"gulp-notify": "^2.2.0", | ||
"gulp-plumber": "^1.0.1", | ||
"mkdirp": "^0.5.1" | ||
"isparta": "^3.0.3", | ||
"mkdirp": "^0.5.1", | ||
"sinon": "^1.15.4", | ||
"sinon-chai": "^2.8.0", | ||
"tmp": "0.0.27" | ||
}, | ||
@@ -45,4 +55,5 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"prepublish": "gulp build", | ||
"start": "node dist/app.js" | ||
"prepublish": "npm run build", | ||
"build": "gulp build", | ||
"test": "gulp test" | ||
}, | ||
@@ -49,0 +60,0 @@ "repository": { |
# winston-aws-cloudwatch | ||
[![npm](https://img.shields.io/npm/v/winston-aws-cloudwatch.svg)](https://www.npmjs.com/package/winston-aws-cloudwatch) [![JavaScript Standard Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
[![npm](https://img.shields.io/npm/v/winston-aws-cloudwatch.svg)](https://www.npmjs.com/package/winston-aws-cloudwatch) [![Build Status](https://img.shields.io/travis/timdp/winston-aws-cloudwatch.svg)](https://travis-ci.org/timdp/winston-aws-cloudwatch) [![Coverage Status](https://img.shields.io/coveralls/timdp/winston-aws-cloudwatch.svg)](https://coveralls.io/r/timdp/winston-aws-cloudwatch) [![JavaScript Standard Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
@@ -5,0 +5,0 @@ A [Winston](https://www.npmjs.com/package/winston) transport for |
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
23307
12
539
17