winston-cloudwatch
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -6,3 +6,4 @@ var AWS = require('aws-sdk'), | ||
logGroupName = '', | ||
logStreamName = ''; | ||
logStreamName = '', | ||
intervalId; | ||
@@ -33,2 +34,7 @@ module.exports.init = function(awsLogGroupName, awsLogStreamName, awsAccessKeyId, awsSecretKey, awsRegion) { | ||
}; | ||
if (logEvents.length <= 0) { | ||
return; | ||
} | ||
cloudwatchlogs.putLogEvents(payload, function(err, data) { | ||
@@ -41,3 +47,5 @@ if (err) return console.log(err, err.stack); | ||
} | ||
setInterval(upload, 1000); | ||
if (!intervalId) { | ||
intervalId = setInterval(upload, 1000); | ||
} | ||
}; | ||
@@ -44,0 +52,0 @@ |
{ | ||
"name": "winston-cloudwatch", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Send logs to Amazon Cloudwatch using Winston.", | ||
@@ -5,0 +5,0 @@ "keywords": ["amazon", "cloudwatch", "winston", "logging", "log"], |
var winston = require('winston'), | ||
options = { | ||
logGroupName: 'testing', | ||
logStreamName: 'testing', | ||
awsAccessKeyId: 'your-access-key-id', | ||
awsSecretKey: 'your-secret-key' | ||
}; | ||
winston.add(require('winston-cloudwatch'), options); | ||
// aws keys are optional | ||
options = { | ||
logGroupName: 'testing', | ||
logStreamName: 'testing', | ||
awsAccessKeyId: 'your-access-key-id', | ||
awsSecretKey: 'your-secret-key' | ||
}; | ||
winston.add(require('../index'), options); | ||
winston.silly('log this 1', { and: 'this too 1' }); | ||
winston.debug('log this 2', { and: 'this too 2' }); | ||
winston.verbose('log this 3', { and: 'this too 3' }); | ||
winston.info('log this 4', { and: 'this too 4' }); | ||
winston.warn('log this 5', { and: 'this too 5' }); | ||
winston.error('log this 6', { and: 'this too 6' }); | ||
winston.silly('silly', { and: 'this too 1' }); | ||
winston.debug('debug', { and: 'this too 2' }); | ||
winston.verbose('verbose', { and: 'this too 3' }); | ||
winston.info('info', { and: 'this too 4' }); | ||
winston.warn('warn', { and: 'this too 5' }); | ||
winston.error('error', { and: 'this too 6' }); |
7668
95