pdlog

0.0.2 • Public • Published

pdlog

Yet another JS log module with prefixes made of a custom string and a timestamp.


Installation:

npm i --save pdlog

Usage:

const c = require('pdlog')('#WHATEVER');
c.log('hello world');

Output:

[2017-07-31T15:49:57.161Z] #WHATEVER hello world

Methods:

  • log()
  • error()
  • warn()
  • info()
  • debug()

Custom prefix function (well, why not!)

const c = require('pdlog')(() => Date.now())
c.log('hello world');

Output:

685051200000 hello world

* function's result will be used without the built-in date prefix

Options:

quiet: <function>

Why function? Because you probably want to have an ability to switch it on or off dynamically.

let quietMode = false;
const c = require('pdlog')('quiet check', {quiet: () => quietMode});

c.log('you will see this');

quietMode = true;

c.log('you will not see this');

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i pdlog

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • lolwho