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 1.0.0 to 1.0.1

16

filter-log.js

@@ -1,3 +0,1 @@

var _ = require('underscore')
var util = require('util')

@@ -14,5 +12,3 @@ var isStream = require('is-stream')

function writeToProcessors(data) {
_.each(_.values(filterLog.logsProc), function(processor) {
processor.head.write(data)
})
Object.values(filterLog.logsProc).forEach(processor => processor.head.write(data))
}

@@ -29,3 +25,3 @@

}
writeToProcessors(_.extend(filterLog.baseInformationGenerator(),
writeToProcessors(Object.assign(filterLog.baseInformationGenerator(),
{loggerName: name}, filterLog.logsData[name], stream.loggerSpecificData, data))

@@ -35,3 +31,3 @@ callback()

_.each(_.keys(filterLog.levels), function(key) {
Object.keys(filterLog.levels).forEach(key => {
stream[key.toLowerCase()] = function(data) {

@@ -49,3 +45,3 @@ if(typeof data == 'string') {

if(typeof data == 'object') {
stream.write(_.extend({}, data, {level: filterLog.levels[key]}))
stream.write(Object.assign({}, data, {level: filterLog.levels[key]}))
}

@@ -123,3 +119,3 @@ }

filterLog.defineLoggerBaseData = function(loggerName, data) {
data = _.extend({}, data)
data = Object.assign({}, data)
delete data.loggerName

@@ -134,3 +130,3 @@ filterLog.logsData[loggerName] = data

destination: destination || process.stdout,
baseData: _.extend({}, baseData, { processorName: name }),
baseData: Object.assign({}, baseData, { processorName: name }),

@@ -137,0 +133,0 @@ // should be a function or stream of some sort

{
"name": "filter-log",
"version": "1.0.0",
"version": "1.0.1",
"description": "flexible, minimalistic logging",

@@ -16,5 +16,2 @@ "main": "filter-log.js",

},
"bin": {
"filter-log": "./filter-log-command.js"
},
"keywords": [

@@ -37,9 +34,11 @@ "logging",

"dependencies": {
"is-stream": "^1.1.0",
"JSONStream": "^1.3.1",
"minimist": "^1.2.8",
"through2": "^2.0.3",
"tripartite": "^1.0.7",
"underscore": "^1.8.3"
}
"is-stream": "^1.1.0"
},
"files": [
"/filters",
"/streams",
"/transforms",
"/filter-log.js",
"README.md"
]
}

@@ -125,12 +125,5 @@ # filter-log

```
filter-log -h
```
or
See the filter-log-tools package
```
cat my-log.json | filter-log > my-log.txt
```
Anything complicated though, and it may be much easier to write your own tiny program to process the entries. `exmaples/process-1.js` is a simple example. The source for `filter-log-command.js` may also serve as an example.

@@ -140,2 +133,1 @@

@@ -1,11 +0,16 @@

var through2 = require('through2')
const { Transform } = require('stream')
var createStream = function(filter) {
var stream = through2({ objectMode: true }, function(chunk, enc, callback) {
if(filter(chunk)) {
this.push(chunk)
var createStream = function (filter) {
let stream = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
if (filter(chunk)) {
this.push(chunk)
}
callback()
}
callback()
})
return stream

@@ -12,0 +17,0 @@ }

@@ -1,15 +0,18 @@

var through2 = require('through2')
const { Transform } = require('stream')
var createStream = function() {
var stream = through2({ objectMode: true }, function(chunk, enc, callback) {
this.data.push(chunk)
callback()
var createStream = function (filter) {
let stream = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
this.data.push(chunk)
callback()
}
})
stream.data = []
return stream
}
module.exports = createStream
module.exports = createStream

@@ -1,18 +0,14 @@

var through2 = require('through2')
// var stream = require('stream');
const { Transform } = require('stream')
// var createStream = function() {
// return new stream.Transform({objectMode: true})
// }
//
// module.exports = createStream
var createStream = function () {
let stream = new Transform({
objectMode: true,
var createStream = function() {
var stream = through2({ objectMode: true }, function(chunk, enc, callback) {
this.push(chunk)
callback()
transform(chunk, encoding, callback) {
this.push(chunk)
callback()
}
})
return stream

@@ -19,0 +15,0 @@ }

@@ -1,14 +0,17 @@

var through2 = require('through2')
const { Transform } = require('stream')
var createStream = function() {
var stream = through2({ objectMode: false }, function(chunk, enc, callback) {
var result = chunk.toString()
this.data += result
this.push(result)
callback()
var createStream = function () {
let stream = new Transform({
objectMode: false,
transform(chunk, encoding, callback) {
var result = chunk.toString()
this.data += result
this.push(result)
callback()
}
})
stream.data = ''
return stream

@@ -15,0 +18,0 @@ }

@@ -1,12 +0,18 @@

var through2 = require('through2')
const { Transform } = require('stream')
var createStream = function(transform) {
var stream = through2({ objectMode: true }, function(chunk, enc, callback) {
this.push(transform(chunk))
callback()
var createStream = function (transform) {
let stream = new Transform({
objectMode: true,
transform(chunk, encoding, callback) {
this.push(transform(chunk))
callback()
}
})
return stream
}
module.exports = createStream
module.exports = createStream
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