src/utils.js
function Logger () {
  const levels = [
    'fatal', // 1
    'error', // 2
    'warn', // 3
    'info', // 4
    'debug' // 5
  ];
  let verbosity = 3;

  levels.forEach((level, idx) => {
    this[level] = (...params) => {
      if (idx + 1 <= verbosity) console.log(...params); // eslint-disable-line
    };
  });

  this.setLevel = (_) => {
    verbosity = _;
  };

  return this;
}
function Logger () {
  const levels = [
    'fatal', // 1
    'error', // 2
    'warn', // 3
    'info', // 4
    'debug' // 5
  ];
  let verbosity = 3;

  levels.forEach((level, idx) => {
    this[level] = (...params) => {
      if (idx + 1 <= verbosity) console.log(...params); // eslint-disable-line
    };
  });

  this.setLevel = (_) => {
    verbosity = _;
  };

  return this;
}
function Logger ( ) { const levels = [ 'fatal' , // 1 'error' , // 2 'warn' , // 3 'info' , // 4 'debug' // 5 ] ; let verbosity = 3 ; levels . forEach ( ( level , idx ) => { this [ level ] = ( ... params ) => { if ( idx + 1 <= verbosity ) console . log ( ... params ) ; // eslint-disable-line } ; } ) ; this . setLevel = ( _ ) => { verbosity = _ ; } ; return this ; }
Simple logger with levels.
1 - fatal
2 - error
3 - warn
4 - info
5 - debug

Logger level set globally with setLevel().
Logging done using logger.<level>().
Simple logger with levels . 1 - fatal 2 - error 3 - warn 4 - info 5 - debug