thebespokepixel / verbosity

node.js module for controlling cli verbosity
http://thebespokepixel.github.io/verbosity/
MIT License
4 stars 1 forks source link

Example code not working #113

Open devolution2409 opened 2 years ago

devolution2409 commented 2 years ago

Hi, Just installed your packaged and tried to play around with it using the example provided on the npm page.

The following line will trigger an error despite the comment saying it should work. console.verbosity('warning'); // Use named levels [debug, info, log, warning, error]

Here's the error:

node_modules\verbosity\index.js:118
      level = typeof level === 'string' ? this.matrix[level].level : level;
 TypeError: Cannot read property 'level' of undefined
    at console.verbosity 
node_modules\verbosity\index.js:118:62)

And the full code:

import { createConsole } from 'verbosity';

const console = createConsole({
  outStream: process.stdout,
  errorStream: process.stderr,
  verbosity: 5,
});
console.verbosity('warning'); // Use named levels [debug, info, log, warning, error]

console.debug('...this isn’t printed now.');

Maybe i misunderstood the comment in which case i apologize :)