Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filter-log

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-log - npm Package Compare versions

Comparing version 0.0.5 to 1.0.0

12

package.json
{
"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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc