2.0.6 • Published 7 years ago

id.log v2.0.6

Weekly downloads
11
License
CC-BY-NC-SA-4.0
Repository
github
Last release
7 years ago

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

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago