winston-cloudwatch
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
### 1.11.4 | ||
Correctly stringifies Error objects preserving stuff like the message and the stack | ||
Fixes https://github.com/lazywithclass/winston-cloudwatch/issues/54 | ||
### 1.11.3 | ||
@@ -2,0 +8,0 @@ |
@@ -23,3 +23,3 @@ 'use strict'; | ||
var messageFormatter = options.messageFormatter ? options.messageFormatter : function(log) { | ||
return _.isEmpty(log.meta) ? | ||
return _.isEmpty(log.meta) && !(log.meta instanceof Error) ? | ||
[ log.level, log.msg ].join(' - ') : | ||
@@ -26,0 +26,0 @@ [ log.level, log.msg, stringify(log.meta) ].join(' - '); |
var chalk = require('chalk'); | ||
function stringify(o) { return JSON.stringify(o, null, ' '); } | ||
function handleErrorObject(key, value) { | ||
if (value instanceof Error) { | ||
return Object.getOwnPropertyNames(value).reduce(function(error, key) { | ||
error[key] = value[key] | ||
return error | ||
}, {}) | ||
} | ||
return value | ||
} | ||
function stringify(o) { return JSON.stringify(o, handleErrorObject, ' '); } | ||
@@ -24,1 +33,2 @@ function debug() { | ||
}; | ||
{ | ||
"name": "winston-cloudwatch", | ||
"version": "1.11.3", | ||
"version": "1.11.4", | ||
"description": "Send logs to Amazon Cloudwatch using Winston.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# winston-cloudwatch [v1.11.3](https://github.com/lazywithclass/winston-cloudwatch/blob/master/CHANGELOG.md#1113) | ||
# winston-cloudwatch [v1.11.4](https://github.com/lazywithclass/winston-cloudwatch/blob/master/CHANGELOG.md#1114) | ||
@@ -40,2 +40,7 @@ [](https://travis-ci.org/lazywithclass/winston-cloudwatch) [](https://coveralls.io/github/lazywithclass/winston-cloudwatch?branch=master) [](https://david-dm.org/lazywithclass/winston-cloudwatch) [](https://david-dm.org/lazywithclass/winston-cloudwatch#info=devDependencies) [](https://david-dm.org/lazywithclass/winston-cloudwatch#info=peerDependencies) | ||
As a best practice remember to use one stream per resource, so for example if you have 4 servers you should setup 4 streams | ||
on AWS CloudWatch Logs, this is a general best practice to avoid incurring in token clashes and to avoid limits of the service (see [usage](#usage) for more). | ||
#### Region note | ||
As specified [in the docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_the_Region): | ||
@@ -49,4 +54,10 @@ | ||
#### AWS UI | ||
For displaying time in AWS CloudWatch UI you should click on the gear in the top right corner in the page with your logs and enable checkbox "Creation Time". | ||
##### TypeScript | ||
Remember to install types for both winston and this library. | ||
### Usage | ||
@@ -53,0 +64,0 @@ |
49878
3.49%22
4.76%1052
3.34%144
8.27%