npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

caro-console

v0.9.6

Published

The module for easy-reading node.js console

Downloads

49

Readme

Caro-Console

Build Status

The module for easy-reading node.js console depend on cli-color

Install and Usage

$ npm install caro
var cc = require('caro-console');
cc.log('This is caro-console');

Print nonstop-log

cc.log('This is ', undefined).log('And arr = ', ['caro', 'console']).log('End');

var name = 'caro';
var age = 18;
cc.log('I am %s and %s years old', name, age);
cc.log('I am ', name, ' and ', age, ' years old');

Set your log styles

cc.log.setOddColor('red').setEvenColor('magenta').setStyle('bold', 'underline');
cc.log('This is msg with color-red');
cc.log('This is msg with color-magenta');

Create a new log-function for yourself

cc.createLog('err').setOddColor('red').setEvenColor('magenta');
cc.err('This is Log used for error');

cc.createLog('notice').setColor('cyan').setStyle('bold', 'underline');
cc.notice('This is Log used for notice');

Support print Error

cc.log(new Error('This is Error')); // 'Error: This is Error'

Settings

  • setColor([color='white']) - set log-color
cc.log.setColor('green');
  • setOddColor([color='white']) - set log-color when it's odd
cc.log.setOddColor('green');
  • setEvenColor([color='white']) - set log-color when it's even
cc.log.setEvenColor('green');
  • setStyle(style...) - set log-style
cc.log.setStyle('bold', 'underline');
  • setLine([length=0]) - will print line after each log
cc.log.setLine(40);
cc.log('This is Log with line after');
/*
This is Log with line after
========================================
*/
  • showMe([bool=true]) - show stack-info that log placed
/* e.g. in [/caro-console/caro-console.js] */
cc.log.showMe();
cc.log('This is log with stack-info');
/*
Context.<anonymous> (/caro-console/caro-console.coffee:3:4)
This is log with stack-info
*/
  • head(string | function) - show pre-log
var index = 0
cc.log.head(() ->
  var date = new Date();
  return '**Index:' + (++index) + ' - ' + date + '**';
);
cc.log('This is log 1');
cc.log('This is log 2');
/*
**Index:1 - Tue Jun 09 2015 19:00:24 GMT+0800 (CST)**
This is log 1
**Index:2 - Tue Jun 09 2015 19:00:24 GMT+0800 (CST)**
This is log 2
*/
cc.log.head(null)
cc.log('This is log without head')
  • resetAll() - reset all settings
cc.log.resetAll();

Method

  • createLog(logName) - create a new log-function
cc.createLog('err').setColor('red');
cc.err('This is Log used for error');
  • line([length=40] [ifDouble=true]) - print line
cc.line(); // ========================================
cc.line(40,false); // ----------------------------------------
  • accept(logName...) - choice which log-function you want to print
cc.log.setColor('white');
cc.createLog('info').setColor('green');
cc.createLog('err').setColor('red');
if (process.env.ENV_VARIABLE === 'production') {
    // only print cc.err and cc.info in console when production
    cc.accept('err', 'info');
} else {
    cc.accept(); // accept all
}
cc.log('This is Log'); // won't print when production
cc.info('This is Info');
cc.err('This is Err'); 
  • showWhere() - print stack-list
/* e.g. in [/caro-console/caro-console.js] */
cc.showWhere();
/*
[ 
    'Context.<anonymous> (/caro-console/caro-console.js:2:4)',
    ...
    ...
]
*/

History

  • Fix bug of print null - v0.9.2
  • Print object by JSON - v0.9.1
  • Support print Error - v0.9.0
  • Add [Settings -> head] - v0.8.0
  • Add [Method -> showWhere] - v0.7.0
  • Add [Settings -> showMe] - v0.6.0
  • Remove [Settings -> setBreakLine] - v0.5.2
  • Update [Settings -> setLine] lineLength default to 0 - v0.5.2
  • Remove [Method -> lineLog] - v0.5.2