id.log

2.0.6 • Public • Published

id.log

id.log is a Node.JS module, alternative to console.log, with some powerful features !

NPM Version travis CircleCI Build Status xo

Install

npm install id.log --save

Usage

const id = require('id.log');
id.log('Hello dudes !');
// =>  2017-10-28 10:48:37 - Hello dudes !

isDev() : set your current environment

You can play with isDev, like electron-is-dev :

id.isDev(false);
id.log('No dev env');
// No output in prod env
 
id.isDev(true);
id.log('Dev env Hell YEAH');
// =>  2017-10-28 10:48:37 - Dev env Hell YEAH

Or like this :

if(process.env.NODE_ENV === 'production') {
    id.isDev(false);
}
id.log('Dev env Hell YEAH');

You can edit all the arguments by passing an object to id() :

Setup all options

The better way to do it :

const args = {
    id: 'goodid',
    date: true,
    separator: '🦄',
    quietMode: false,
    priority: 9  // all messages > 9 are displayed
};
 
id(args);
 
id.log('Dev env Hell YEAH');
// Goodid 🦄 2017-10-28 10:48:37 🦄 Dev env Hell YEAH

You can change everything :

  • id: not used by default, but useful for socket instances
  • date: true, by default, but you can set it to false
  • separator: default to '-', but you can use a beautiful unicorn emoji '🦄'
  • quietMode: false by default, you can handle it with isDev(), or set it with the main way. As YOU want !
  • priority: set a minimum indicator for the quiet mode. By default, you set the priority on 5. This mean, if you send this log id.log('message', 4), we don't display it.

Licence

CC-BY-NC-SA-4.0 - Arthur Lacoste

Package Sidebar

Install

npm i id.log

Weekly Downloads

1

Version

2.0.6

License

CC-BY-NC-SA-4.0

Last publish

Collaborators

  • arthak