Package Exports
- caterpillar-filter
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (caterpillar-filter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Filter Transform for Caterpillar
Filter out undesired log levels from your Caterpillar logger stream
Install
Backend
- Install Node.js
npm install --save caterpillar-filter
Frontend
Usage
Example
// Import
var logger = require('caterpillar').create();
var filter = require('caterpillar-filter').create({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 optionalpipe(child)pipe our stream to the child, also sync our config to itsetConfig(config)set the configuration and emit theconfigeventgetConfig()get the configurationformat(entry)format the caterpillar logger entry
- Configuration
levelnumber, defaults to6, anything higher will be omitted
- Events
config(config)emitted once our configuration has updated
History
You can discover the history inside the History.md file
License
Licensed under the incredibly permissive MIT License
Copyright © 2012+ Bevry Pty Ltd
Copyright © 2011 Benjamin Lupton


