Skip to content

tim-maastricht/nodejs-hackathon-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smallog

Node.js Hackathon Project

Reason For Existence

Regular logging bores me. Stack traces in the terminal are long, annoying and the dark grey colour is condescending. I wanted to shorten the functions themselves so I can save miliseconds aswell. This is just a basic wrapper.

How To Install

Just run npm i smallog

How To Use

Put this at the top of your file

const log = require('smallog');

Instead of your regular

console.log("Here is text" === 1);

Use this instead

log("here is text" === 1);

For successes

log.win("this will be green with a SUCCESS message to show you did the thing correctly!);

For bad bigmad

log.fail("this will be red with a FAIL message and a short two-line stack trace so your whole terminal doesn't clog up.");

And a contrived try/ catch

// example failure in action
try {
  a == 1 / 0;
  log.win(a);
} catch (e) {
  log.fail(e);
}

How about some grouping

log("base");
log.nest("nested");
log("level 2");
log.nest("nested");
log("level 3");
log.nestEnd();
log.fail("Something went wrong");
log.nestEnd();
log.win("Back to base");

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors