Skip to content

sergeysova/conlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conlog

Simple colorful logger for node.js console

NPM

Mocha Testing Dependencies npm version Code Climate Downloads GitHub tag

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();

About

Simple colorful logger for node.js console

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published