index.js
function parseEnvironment(env, cfg) {
  assume(cfg).is.an('object');
  let _default = cfg.level || 'info';
  if (!env || env === '') {
    return _default;
  }
  assume(env).is.a('string');
  let modules = env.split(',').map(x => x.trim());
  for (let x of modules) {
    let tokens = x.split(':');
    if (tokens.length < 2) {
      let errStr = 'Log levels must use format name:level ' +
        'not ' + tokens.join(':');
      throw new Error(errStr);
    }
    let level = tokens.slice(tokens.length - 1)[0];
    let name = tokens.slice(0, tokens.length - 1).join(':');
    if (allowedLevels.indexOf(level) === -1) {
      let errStr = 'Invalid log level setting: ' + level;
      throw new Error(errStr);
    }
    if (minimatch(cfg.name, name)) {
      return level;
    }
  }

  return _default;
}
function parseEnvironment(env, cfg) {
  assume(cfg).is.an('object');
  let _default = cfg.level || 'info';
  if (!env || env === '') {
    return _default;
  }
  assume(env).is.a('string');
  let modules = env.split(',').map(x => x.trim());
  for (let x of modules) {
    let tokens = x.split(':');
    if (tokens.length < 2) {
      let errStr = 'Log levels must use format name:level ' +
        'not ' + tokens.join(':');
      throw new Error(errStr);
    }
    let level = tokens.slice(tokens.length - 1)[0];
    let name = tokens.slice(0, tokens.length - 1).join(':');
    if (allowedLevels.indexOf(level) === -1) {
      let errStr = 'Invalid log level setting: ' + level;
      throw new Error(errStr);
    }
    if (minimatch(cfg.name, name)) {
      return level;
    }
  }

  return _default;
}
Parse a string into a mapping of logger names to levels to determine which
level of logging a given logging module should use.  This is done so that we
can optionally have Trace level for what you're working on but then only
have warnings and higher for the rest of the code.  This is similar in
concept to the debug module, but needs higher granularity because we have
more than one log level.  There is currently no globbing support so you will
have to specify all 'name' values in the variable as fully resolved.  The
special value '*' as a name sets the log level for all levels not mentioned.

Example Variable: "provisioner:trace, api:info,azure-entities:error, *:fatal"