How to use the log.level function in log

To help you get started, we’ve selected a few log examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arangodb / arangodb / js / client / modules / @arangodb / testing / utils.js View on Github external
port = findFreePort(options.maxPort);
    endpoint = protocol + '://127.0.0.1:' + port;
  } else {
    endpoint = addArgs['server.endpoint'];
    port = endpoint.split(':').pop();
  }

  let instanceInfo = {
  role, port, endpoint, rootDir};

  args['server.endpoint'] = endpoint;
  args['database.directory'] = dataDir;
  args['log.file'] = fs.join(rootDir, 'log');

  if (options.verbose) {
    args['log.level'] = 'info';
  } else {
    args['log.level'] = 'error';
  }

  // flush log messages directly and not asynchronously
  // (helps debugging)  
  args['log.force-direct'] = 'true';

  if (protocol === 'ssl') {
    args['ssl.keyfile'] = fs.join('UnitTests', 'server.pem');
  }

  args = Object.assign(args, options.extraArgs);

  if (addArgs !== undefined) {
    args = Object.assign(args, addArgs);
github arangodb / arangodb / js / client / modules / @arangodb / testsuites / arangosh.js View on Github external
function runTest (section, title, command, expectedReturnCode, opts) {
    print('--------------------------------------------------------------------------------');
    print(title);
    print('--------------------------------------------------------------------------------');
    let weirdNames = ['some dog', 'ла́ять', '犬', 'Kläffer'];
    let tmpPath = fs.getTempPath();
    let tmp = fs.join(tmpPath, weirdNames[0], weirdNames[1], weirdNames[2], weirdNames[3]);
    process.env.TMPDIR = tmp;
    process.env.TEMP = tmp;
    process.env.TMP = tmp;
    fs.makeDirectoryRecursive(process.env.TMPDIR);
    pu.cleanupDBDirectoriesAppend(tmp);
    let args = pu.makeArgs.arangosh(options);
    args['javascript.execute-string'] = command;
    args['log.level'] = 'error';

    for (let op in opts) {
      args[op] = opts[op];
    }

    const startTime = time();
    let rc = executeExternalAndWait(pu.ARANGOSH_BIN, toArgv(args));
    const deltaTime = time() - startTime;
    const failSuccess = (rc.hasOwnProperty('exit') && rc.exit === expectedReturnCode);

    if (!failSuccess) {
      ret.failed += 1;
      ret[section].failed = 1;
      ret[section]['message'] =
        'didn\'t get expected return code (' + expectedReturnCode + '): \n' +
        yaml.safeDump(rc);
github evilpie / jsctags / bin / jsctags.js View on Github external
sys.puts(e);
    usage();
}

var pathCount = argv.length - 2;
if (opts.help || pathCount === 0) {
    usage();
}

if (opts.warning) {
    var level = opts.warning.toUpperCase();
    if (!log.levels.hasOwnProperty(level)) {
        sys.puts("no such logging level: \"" + opts.warning + "\"");
        usage();
    }
    log.level = log.levels[level];
}

function idFor(st) {
    return st.dev + "," + st.ino;
}

var librootIds = {};
if ('libroot' in opts) {
    opts.libroot.forEach(function(libroot) {
        var st = fs.statSync(libroot);
        librootIds[idFor(st)] = true;
    });
}

var tags = new Tags();
github RequestPolicyContinued / requestpolicy / src / content / lib / classes / rp-log.ts View on Github external
}).then((result) => {
      this.setLevel(result["log.level"] as LogLevel);
      const enable = result.log as boolean;

      this.asyncSettings.onChanged.addListener(
          this.onStorageChanged.bind(this),
      );

      return enable;
    });
    pEnabled.catch((e) => {
github RequestPolicyContinued / requestpolicy / src / content / lib / classes / rp-log.ts View on Github external
private onStorageChanged(
      aChanges: browser.storage.ChangeDict,
      aAreaName: browser.storage.StorageName,
  ) {
    if (aChanges.hasOwnProperty("log")) {
      this.setEnabled(aChanges.log.newValue);
    }
    if (aChanges.hasOwnProperty("log.level")) {
      this.setLevel(aChanges["log.level"].newValue);
    }
  }
}