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

caterpillar-human

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caterpillar-human

Turn your [Caterpillar](https://github.com/bevry/caterpillar) logger stream into a beautiful readable format with colors and optional debug information

  • 2.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
decreased by-21.05%
Maintainers
1
Weekly downloads
 
Created
Source

Human Transform for Caterpillar

Build Status NPM version Dependency Status Development Dependency Status
Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button

Turn your Caterpillar logger stream into a beautiful readable format with colors and optional debug information

Install

Node

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

Browserify

  • Use: require('caterpillar-human')
  • Install: npm install --save caterpillar-human
  • CDN URL: //wzrd.in/bundle/caterpillar-human@2.1.2

Ender

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

Usage

Example

// Import
var logger = require('caterpillar').createLogger();
var human = require('caterpillar-human').createHuman();

// Pipe logger output to our human interface, then our human interface output to stdout
logger.pipe(human).pipe(process.stdout);

// Log
logger.log('warn',  'this is the first log entry');
// warn:  this is the first log entry
logger.log('info', 'this is the second log entry');
// info: this is the second log entry

// Wait
setTimeout(function(){
	// Set debug mode
	logger.setConfig({level:7});

	// Log
	logger.log('warn',  'this is the first log entry');
	// warn: this is the first log entry
	//	→ [2013-04-25 20:37:22.692] [/Users/balupton/Projects/caterpillar-human/example.js:20] [null._onTimeout]
	logger.log('info', 'this is the second log entry');
	// info: this is the second log entry
	//	→ [2013-04-25 20:37:22.693] [/Users/balupton/Projects/caterpillar-human/example.js:22] [null._onTimeout]
},0);

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

new (require('caterpillar-human').Human)(config)
  • Methods

    • constructor(config?) create our new human 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 null, when set to 7 (debug level) we will debug information with the log entries

    • color boolean, defaults to true, set to false to turn off colors

    • colors objects of the level to color mapping, defaults to:

      {
      	0: 'red',
      	1: 'red',
      	2: 'red',
      	3: 'red',
      	4: 'yellow',
      	5: 'yellow',
      	6: 'green',
      	7: 'green'
      }
      
  • 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 BitCoin 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 10 Jan 2014

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