1.0.0 • Published 9 years ago

conlog v1.0.0

Weekly downloads
23
License
-
Repository
github
Last release
9 years ago

conlog

Simple colorful logger for node.js console

NPM

Using

var __c = require('./index')('test');

"Info only message".info();
"Debug information".debug();
"Warning message".warn();
"RED ERROR!".error();
"Simple log".log();
"Indented text".li();

__c.empty(2);
__c.name('update');

__c.disable();
"Run %s".log("Forrest");
"Test with %s arguments from %s %s".debug('many', 'log', 'function');

"".empty();

__c.enable();
"Start log in %s environment".log("debug");
"%s listening on %s port".info("Express", "1240");

Result:

06 May 01:44:37 [test] Info only message
     debug      [test] Debug information
06 May 01:44:37 [test] Warning! Warning message
06 May 01:44:37 [test] RED ERROR!
06 May 01:44:37 [test] Simple log
                [test] Indented text


06 May 01:44:37 [update] Run Forrest
     debug      [update] Test with many arguments from log function

06 May 01:44:37 [update] Start log in debug environment
06 May 01:44:37 [update] Express listening on 1240 port

You can use attributes from Colors:

"Using:".log();
"help".green.li();
"exit".green.li();
"quit".green.li();

And you can use %s template:

"Start log in %s environment".log("debug");
"%s listening on %s port".info("Express", "1240");

Shows n empty lines:

var __c = require('conlog')('appname');

// three empty lines
__c.empty(3);
// equal with
"".empty(3); // or any string

// shows one empty string
"".empty(); // or __c.empty();

Options

You can change the app name if you want:

var __c = require('conlog')('appname');

__c.name('newappname');

You can disable and enable color output:

var enablecolors = true;
var __c = require('conlog')('appname', enablecolors);

"Hello %s".log('world');

__c.disable();

"Specify log info".info();
"Warning".warn();
"Error".error();

__c.enable();

"Colorful text".log();
1.0.0

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago