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.3 to 0.0.4

examples/basic-boring.js

26

filter-log.js

@@ -11,7 +11,6 @@ var _ = require('underscore')

var logsData = {}
var logsProc = {}
function writeToProcessors(data) {
_.each(_.values(logsProc), function(processor) {
_.each(_.values(filterLog.logsProc), function(processor) {
processor.head.write(data)

@@ -31,3 +30,3 @@ })

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

@@ -105,6 +104,17 @@ }

if(!global['filter-log-logsData']) {
global['filter-log-logsData'] = {}
}
filterLog.logsData = global['filter-log-logsData']
if(!global['filter-log-logsProc']) {
global['filter-log-logsProc'] = {}
}
filterLog.logsProc = global['filter-log-logsProc']
filterLog.defineLoggerBaseData = function(loggerName, data) {
data = _.extend({}, data)
delete data.loggerName
logsData[loggerName] = data
filterLog.logsData[loggerName] = data
}

@@ -136,3 +146,3 @@

procData.head.pipe(procData.transformer).pipe(procData.destination)
logsProc[name] = procData
filterLog.logsProc[name] = procData
}

@@ -149,7 +159,7 @@

filterLog.clearProcessors = function() {
logsProc = {}
filterLog.logsProc = {}
}
filterLog.removeProcessor = function(name) {
delete logsProc[name]
delete filterLog.logsProc[name]
}

@@ -156,0 +166,0 @@

{
"name": "filter-log",
"version": "0.0.3",
"version": "0.0.4",
"description": "flexible, minimalistic logging",

@@ -9,4 +9,4 @@ "main": "filter-log.js",

"testDebug": "node_modules/mocha/bin/mocha --inspect --debug-brk",
"gen-random-logs": "./examples/gen-random-logs.js > examples/gen-random-logs.json",
"process-1": "cat examples/gen-random-logs.json | ./examples/process-1.js > examples/process-1.txt"
"gen-random-logs": "./examples/gen-random-logs.js > examples/gen-random-logs.json",
"process-1": "cat examples/gen-random-logs.json | ./examples/process-1.js > examples/process-1.txt"
},

@@ -13,0 +13,0 @@ "repository": {

@@ -23,4 +23,9 @@ # filter-log

```
# probably somewhere in the application or environment setup code
var filog = require('filter-log')
filog.defineProcessor('standard', {}, process.stdout)
# ... somewhat later, in a module, perhaps
var filog = require('filter-log')
var log = filog()

@@ -32,5 +37,5 @@ log.info('hello, world!')

Line 3 creates a new logger. It has the basic tools you'd expect for logging by level and string interpolation. Line 4 creates a new log entry, sets the level to "info" and publishes it.
Line 4 creates a new logger. It has the basic tools you'd expect for logging by level and string interpolation. Line 5 creates a new log entry, sets the level to "info" and publishes it.
If you run this example, a JSON formatted log entry will show up in stdout.
If you run this example, a JSON formatted log entry will show up in stdout. (see `./examples/basic-boring.js`)

@@ -37,0 +42,0 @@ ## Logging more Data

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