Filter out undesired log levels from your Caterpillar logger stream
Install
Backend
- Install Node.js
npm install --save caterpillar-filter
Frontend
- See Browserify
Usage
Example
var logger = require('caterpillar').create();
var filter = require('caterpillar-filter').create({logLevel:6});
logger.pipe(filter).pipe(process.stdout);
logger.log('info', 'this is the first log entry');
logger.log('debug', 'this is the second log entry');
logger.log('info', 'this is the third log entry');
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 the config
eventgetConfig()
get the configurationformat(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
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