filter-log
Advanced tools
Comparing version 0.0.5 to 1.0.0
{ | ||
"name": "filter-log", | ||
"version": "0.0.5", | ||
"version": "1.0.0", | ||
"description": "flexible, minimalistic logging", | ||
"main": "filter-log.js", | ||
"scripts": { | ||
"test": "node_modules/mocha/bin/mocha", | ||
"testDebug": "node_modules/mocha/bin/mocha --inspect --debug-brk", | ||
"test": "node_modules/mocha/bin/mocha.js", | ||
"testDebug": "node_modules/mocha/bin/mocha.js --inspect --debug-brk", | ||
"gen-random-logs": "./examples/gen-random-logs.js > examples/gen-random-logs.json", | ||
@@ -32,9 +32,9 @@ "process-1": "cat examples/gen-random-logs.json | ./examples/process-1.js > examples/process-1.txt" | ||
"chai": "^4.0.2", | ||
"mocha": "^3.4.2", | ||
"mocha": "^10.2.0", | ||
"random-strings": "0.0.1" | ||
}, | ||
"dependencies": { | ||
"is-stream": "^1.1.0", | ||
"JSONStream": "^1.3.1", | ||
"is-stream": "^1.1.0", | ||
"minimist": "^1.2.0", | ||
"minimist": "^1.2.8", | ||
"through2": "^2.0.3", | ||
@@ -41,0 +41,0 @@ "tripartite": "^1.0.7", |
@@ -68,7 +68,19 @@ var filog = require('../filter-log') | ||
let e = new Error(msg) | ||
debugger | ||
log1.info(e) | ||
assert(out.data[0].error.toString().indexOf('Error: This is a test') == 0) | ||
}) | ||
it("test error object string", function() { | ||
filog.clearProcessors() | ||
var out = stringStream() | ||
filog.defineProcessor('string-out', null, out) | ||
let msg = 'This is a test' | ||
let e = new Error(msg) | ||
log1.info(e) | ||
// basically, we just want to ensure that we got a stack trace from our error | ||
assert(out.data.length > 200) | ||
}) | ||
}) |
var through2 = require('through2') | ||
function errorSerialization(key, obj) { | ||
if (obj instanceof Error) { | ||
return { | ||
name: obj.name, | ||
message: obj.message, | ||
stack: obj.stack | ||
} | ||
} | ||
return obj | ||
} | ||
var transformer = function(prefix, suffix) { | ||
return through2({ objectMode: true }, function(chunk, enc, callback) { | ||
var result = JSON.stringify(chunk) | ||
if(prefix) { | ||
var transformer = function (prefix, suffix) { | ||
return through2({ objectMode: true }, function (chunk, enc, callback) { | ||
var result = JSON.stringify(chunk, errorSerialization) | ||
if (prefix) { | ||
this.push(prefix) | ||
} | ||
this.push(result) | ||
if(suffix) { | ||
this.push(result) | ||
if (suffix) { | ||
this.push(suffix) | ||
} | ||
callback() | ||
callback() | ||
}) | ||
@@ -16,0 +26,0 @@ } |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
34840
438
0
Updatedminimist@^1.2.8