Caterpillar
Caterpillar is an awesome, simple, intuitive console logger for node.js. It supports grouping of messages, filtering log levels, colors, times, modules, custom formatters and custom transports.
Example
# Requires
caterpillar = require "#{__dirname}/../lib/caterpillar.coffee"
# Create
logger = new caterpillar.Logger
transports:
level: 7
formatter:
module: module
# Logs
for own name,code of logger.config.levels
logger.log name, "this is #{name} and is level #{code}"
# Standard
logger.log ''
logger.log 'this is awesome'
logger.log 'this','is','awesome'
# Colors
colors = caterpillar.colors
logger.log ''
logger.log 'this is', colors.magenta.bold.italic.underline('awesome')
# Grouping
logger.config.autoFlush = false
logger.log ''
logger.log 'one'
logger.log 'two'
logger.log 'three'
setTimeout(
-> logger.flush()
3000
)
Install
-
Install Node.js
-
Install CoffeeScript
npm -g install coffee-script
-
Install Caterpillar
npm install caterpillar
Thanks
Uses the following:
Inspired by the following:
License
Licensed under the MIT License
Copyright 2011 Benjamin Arthur Lupton