logcl

0.1.0 • Public • Published

logcl

A simple node package with a set of wrapper functions to console.log()

  • cl - console.log or new line
  • clt - console.log title
  • cli - console.log indent (2 spaces)
  • cll - console.log with label and data. data is indented 2 spaces
  • cld - console.log with dashes before and after label

Install

$ npm install logcl --save

Use

Create a reference to the module in code. Then invoke the methods as needed.

code:

var log = require('logcl');
 
var foo = "foo";
var bar = "bar";
 
log.cl('test1');
log.cl();
 
log.clt('My Title');
log.cli('data');
log.cl();
 
log.cld('next test');
log.cll(foo, bar);

output:

$ test1
$
$ My Title
$   data
$
$ ---------- next test
$ foo
$   bar

Examples

cl - console.log or new line

code:

var data = 'hello world';
log.cl();
log.cl(data);

output:

// output
$
$ hello world

clt - console.log with title
cli - console.log with 2 space indent

code:

var title = 'An Object';
var data = { name: 'my object' };
 
log.clt(title);
log.cli(data);

output:

$ An Object
$   { name: 'my object' }

cld - console.log with with dashes before label
cll - console.log with label and data. data is indented 2 spaces

code:

var section = "New Section";
var myNum = 42;
var myArr = [1,2,3];
 
log.cld(section)
log.cll("Number", myNum);
log.cll("Array", myArr);

output:

$ ---------- New Section
$ Number
$   42
$ Array
$   [1, 2, 3]
 

Readme

Keywords

Package Sidebar

Install

npm i logcl

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • jamespriest