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

caterpillar-filter

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caterpillar-filter

Filter out undesired log levels from your [Caterpillar](https://github.com/bevry/caterpillar) logger stream

  • 2.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-48.28%
Maintainers
1
Weekly downloads
 
Created
Source

Filter Transform for Caterpillar

Build Status NPM version Gittip donate button Flattr donate button PayPayl donate button

Filter out undesired log levels from your Caterpillar logger stream

Install

Node, Browserify

  • Use: require('caterpillar-filter')
  • Install: npm install --save caterpillar-filter

Ender

  • Use: require('caterpillar-filter')
  • Install: ender add caterpillar-filter

Usage

Example

// Import
var logger = require('caterpillar').createLogger();
var filter = require('caterpillar-filter').createFilter({level:6});  // omit log level entries above 6

// Pipe logger output to filter, then filter output to stdout
logger.pipe(filter).pipe(process.stdout);

// Log
logger.log('info',  'this is the first log entry');   // info is level 6
logger.log('debug', 'this is the second log entry');  // debug is level 7, this will be omitted by our filter
logger.log('info',  'this is the third log entry');   // info is level 6

// Outputs
// {"args":["this is the first log entry"],"date":"2013-04-25T08:48:38.941Z","levelCode":6,"levelName":"info","line":"9","method":"Object.<anonymous>","file":"/Users/balupton/Projects/caterpillar-filter/example.js"}
// {"args":["this is the third log entry"],"date":"2013-04-25T08:48:38.948Z","levelCode":6,"levelName":"info","line":"11","method":"Object.<anonymous>","file":"/Users/balupton/Projects/caterpillar-filter/example.js"}

Filter API, extends caterpillar.Transform, which extends stream.Transform

new (require('caterpillar-filter').Filter)(config)
  • Methods
    • constructor(config?) create our new filter instance with the config, config is optional
    • pipe(child) pipe our stream to the child, also sync our config to it
    • setConfig(config) set the configuration and emit the config event
    • getConfig() get the configuration
    • format(entry) format the caterpillar logger entry
  • Configuration
    • level number, defaults to 6, anything higher will be omitted
  • Events
    • config(config) emitted once our configuration has updated

History

Discover the change history by heading on over to the History.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Gittip donate button Flattr donate button PayPayl donate button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under the incredibly permissive MIT license

Copyright © 2012+ Bevry Pty Ltd us@bevry.me (http://bevry.me)
Copyright © 2011 Benjamin Lupton b@lupton.cc (http://balupton.com)

Keywords

FAQs

Package last updated on 23 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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