1.0.2 • Published 11 years ago

consolable v1.0.2

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

consolable

consolable - get controls and colors in your nodejs native console

Requirement

  • NodeJS

Quick Start

Start coding: $ npm install consolable

Include in your project require('consolable');

How to Use

require('consorable');

Methods

var consolable = require('consolable');
  • consolable.level(level)

    • ログレベルを変更します、Level Formatセクションにある語で指定できます
    • デフォルトは4です
  • consolable.tag(bool)

    • タグによるプレフィックスを付与するかどうかを変更します
    • デフォルトはtrueです、引数を与えないとトグルします
  • consolable.colorize(bool)

    • ログの本文にカラーを付与するかどうかを変更します
    • デフォルトはfalseです、引数を与えないとトグルします
  • consolable.color(level, color)

    • ログのカラーを変更します、第1引数はLevel Format、第2引数はColor Formatです
    • デフォルトは次の通りです
      • error : red
      • warn : yellow
      • info : grey
      • warn : cyan

Level Format

Level 0

0, none

Level 1

1, error, production

Level 2

2, warn

Level 3

3, info

Level 4

4, log, debug, development

Color Format

grayscale

white, grey, black

colors

blue, cyan, green, magenta, red, yellow

Features

  • control show/hide logs by loglevel option.
  • append colorized tag for message.

Example

var consolable = require('consorable');

consolable.level(2);

console.log('test');      // ignored
console.info('test');     // ignored
console.warn('warn');     // [warn] warn      // [warn] is yellow color
console.error('!ERROR!'); // [error] !ERROR!  // [error] is red color

consolable.level(4);

console.log('test');      // [log] test

consolable.tag(false);

console.log('test');      // test

consolable.colorize(true);

console.log('test');      // test // (cyan color)
console.error('FIXME');   // FIXME // (red color)

consolable.color('error', 'blue');

console.error('FIXME');   // FIXME // (blue color)
1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.6

11 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago