filter-log
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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 | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
0
1
24924
10
207
132
- RemovedJSONStream@^1.3.1
- Removedminimist@^1.2.8
- Removedthrough2@^2.0.3
- Removedtripartite@^1.0.7
- Removedunderscore@^1.8.3
- RemovedJSONStream@1.3.5(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjsonparse@1.3.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthrough@2.3.8(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedtripartite@1.1.4(transitive)
- Removedunderscore@1.13.7(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)