winston
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -88,3 +88,3 @@ /* | ||
// but probably close-enough for purposes of this lib. | ||
copy = new Error(obj.message); | ||
copy = { message: obj.message }; | ||
Object.getOwnPropertyNames(obj).forEach(function (key) { | ||
@@ -264,3 +264,6 @@ copy[key] = obj[key]; | ||
output += ' ' + exports.serialize(meta); | ||
output += '\n' + stack.join('\n'); | ||
if (stack) { | ||
output += '\n' + stack.join('\n'); | ||
} | ||
} else { | ||
@@ -313,2 +316,10 @@ output += ' ' + exports.serialize(meta); | ||
exports.serialize = function (obj, key) { | ||
// symbols cannot be directly casted to strings | ||
if (typeof key === 'symbol') { | ||
key = key.toString() | ||
} | ||
if (typeof obj === 'symbol') { | ||
obj = obj.toString() | ||
} | ||
if (obj === null) { | ||
@@ -315,0 +326,0 @@ obj = 'null'; |
@@ -481,3 +481,3 @@ /* | ||
else if (this.transports[instance.name]) { | ||
throw new Error('Transport already attached: ' + instance.name); | ||
throw new Error('Transport already attached: ' + instance.name + ", assign a different name"); | ||
} | ||
@@ -484,0 +484,0 @@ |
@@ -23,3 +23,3 @@ /* | ||
var fullpath = path.join(__dirname, 'transports', name.toLowerCase()); | ||
return exports[name] = require(fullpath)[name]; | ||
return require(fullpath)[name]; | ||
} | ||
@@ -26,0 +26,0 @@ }; |
@@ -119,3 +119,3 @@ /* | ||
if (this.stderrLevels[level]) { | ||
process.stderr.write(output + '\n'); | ||
process.stderr.write(output + this.eol); | ||
} else { | ||
@@ -122,0 +122,0 @@ process.stdout.write(output + this.eol); |
@@ -290,3 +290,4 @@ /* | ||
function push(log) { | ||
if (options.rows && results.length >= options.rows) { | ||
if (options.rows && results.length >= options.rows | ||
&& options.order != 'desc') { | ||
if (stream.readable) { | ||
@@ -306,2 +307,7 @@ stream.destroy(); | ||
if (options.order === 'desc') { | ||
if (results.length >= options.rows) { | ||
results.shift(); | ||
} | ||
} | ||
results.push(log); | ||
@@ -308,0 +314,0 @@ } |
@@ -65,4 +65,10 @@ var util = require('util'), | ||
req.on('response', function (res) { | ||
var body = ''; | ||
res.on('data', function (chunk) { | ||
body += chunk; | ||
}); | ||
res.on('end', function () { | ||
callback(null, res); | ||
callback(null, res, body); | ||
}); | ||
@@ -69,0 +75,0 @@ |
{ | ||
"name": "winston", | ||
"description": "A multi-transport async logging library for Node.js", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -40,5 +40,5 @@ "maintainers": [ | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -125,3 +125,3 @@ # winston | ||
transports: [ | ||
new require('winston-daily-rotate-file')(opts) | ||
new (require('winston-daily-rotate-file'))(opts) | ||
] | ||
@@ -239,3 +239,3 @@ }); | ||
## Querying Logs | ||
Winston supports querying of logs with Loggly-like options. [See Loggly Search API](http://wiki.loggly.com/retrieve_events#optional). | ||
Winston supports querying of logs with Loggly-like options. [See Loggly Search API](https://www.loggly.com/docs/api-retrieving-data/). | ||
Specifically: `File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`. | ||
@@ -300,2 +300,7 @@ | ||
}); | ||
// | ||
// Exceptions can also be handled by multiple transports. | ||
// | ||
winston.handleExceptions([ transport1, transport2, ... ]); | ||
``` | ||
@@ -302,0 +307,0 @@ |
169404
3887
839