How to use the npmlog.record function in npmlog

To help you get started, we’ve selected a few npmlog 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 lerna / lerna / test / helpers / loggingOutput.js View on Github external
function loggingOutput(minLevel = "info") {
  // returns an array of log messages at or above the prescribed minLevel
  return (
    log.record
      // select all non-empty info, warn, or error logs
      .filter(m => log.levels[m.level] >= log.levels[minLevel] && m.message)
      // return just the normalized message content
      .map(m =>
        normalizeNewline(m.message)
          .split("\n")
          .map(line => line.trimRight())
          .join("\n")
      )
  );
}
github liquidg3 / altair / node_modules / npm / lib / utils / error-handler.js View on Github external
function reallyExit() {
    // truncate once it's been written.
    log.record.length = 0

    itWorked = !code

    // just emit a fake exit event.
    // if we're really exiting, then let it exit on its own, so that
    // in-process stuff can finish or clean up first.
    if (!doExit) process.emit("exit", code)
  }
}
github nullivex / nodist / bin / node_modules / npm / lib / utils / error-handler.js View on Github external
function reallyExit() {
    // truncate once it's been written.
    log.record.length = 0

    itWorked = !code

    // just emit a fake exit event.
    // if we're really exiting, then let it exit on its own, so that
    // in-process stuff can finish or clean up first.
    if (!doExit) process.emit("exit", code)
  }
}
github lerna / lerna / utils / write-log-file / write-log-file.js View on Github external
pref = pref.join(" ");

    m.message
      .trim()
      .split(/\r?\n/)
      .map(line => `${pref} ${line}`.trim())
      .forEach(line => {
        logOutput += line + os.EOL;
      });
  });

  // this must be synchronous because it is called before process exit
  writeFileAtomic.sync(path.join(cwd, "lerna-debug.log"), logOutput);

  // truncate log after writing
  log.record.length = 0;
}
github lerna / lerna / test / helpers / loggingOutput.js View on Github external
afterEach(() => {
  log.record.length = 0;
});
github MobileChromeApps / mobile-chrome-apps / node_modules / cordova / node_modules / npm / lib / utils / error-handler.js View on Github external
function writeLogFile (cb) {
  if (writingLogFile) return cb()
  writingLogFile = true
  wroteLogFile = true

  var fs = require("graceful-fs")
    , fstr = fs.createWriteStream("npm-debug.log")
    , util = require("util")
    , os = require("os")
    , out = ""

  log.record.forEach(function (m) {
    var pref = [m.id, m.level]
    if (m.prefix) pref.push(m.prefix)
    pref = pref.join(' ')

    m.message.trim().split(/\r?\n/).map(function (line) {
      return (pref + ' ' + line).trim()
    }).forEach(function (line) {
      out += line + os.EOL
    })
  })

  fstr.end(out)
  fstr.on("close", cb)
}
github davidhealey / waistline / node_modules / npm / lib / utils / error-handler.js View on Github external
function writeLogFile (cb) {
  if (writingLogFile) return cb()
  writingLogFile = true
  wroteLogFile = true

  var fstr = writeStreamAtomic("npm-debug.log")
    , os = require("os")
    , out = ""

  log.record.forEach(function (m) {
    var pref = [m.id, m.level]
    if (m.prefix) pref.push(m.prefix)
    pref = pref.join(" ")

    m.message.trim().split(/\r?\n/).map(function (line) {
      return (pref + " " + line).trim()
    }).forEach(function (line) {
      out += line + os.EOL
    })
  })

  fstr.end(out)
  fstr.on("close", cb)
}
github ShieldBattery / ShieldBattery / deps / node / deps / npm / lib / utils / error-handler.js View on Github external
function writeLogFile (cb) {
  if (writingLogFile) return cb()
  writingLogFile = true
  wroteLogFile = true

  var fs = require("graceful-fs")
    , fstr = fs.createWriteStream("npm-debug.log")
    , util = require("util")
    , os = require("os")
    , out = ""

  log.record.forEach(function (m) {
    var pref = [m.id, m.level]
    if (m.prefix) pref.push(m.prefix)
    pref = pref.join(' ')

    m.message.trim().split(/\r?\n/).map(function (line) {
      return (pref + ' ' + line).trim()
    }).forEach(function (line) {
      out += line + os.EOL
    })
  })

  fstr.end(out)
  fstr.on("close", cb)
}
github mqlight / nodejs-mqlight / mqlight-log.js View on Github external
logger.entry('logger.ffdc', opts.clientId);
  logger.log('parms', opts.clientId, 'fnc:', opt_fnc);
  logger.log('parms', opts.clientId, 'probeId:', opt_probeId);
  logger.log('parms', opts.clientId, 'data:', opt_data);

  if (npmlog.levels[npmlog.level] <= npmlog.levels.ffdc) {
    header('ffdc', opts.clientId, opts);
    npmlog.log('ffdc', opts.clientId, new Error().stack);
    npmlog.log('ffdc', opts.clientId, '');
    npmlog.log('ffdc', opts.clientId, 'Function Stack');
    npmlog.log('ffdc', opts.clientId, stack.slice(1));
    npmlog.log('ffdc', opts.clientId, '');
    npmlog.log('ffdc', opts.clientId, 'Function History');
    for (var idx = 0; idx < npmlog.record.length; idx++) {
      var rec = npmlog.record[idx];
      if ((rec.level !== 'ffdc') &&
          (npmlog.levels[rec.level] >= npmlog.levels[historyLevel])) {
        npmlog.log('ffdc', opts.clientId, '%d %s %s %s',
                   rec.id, npmlog.disp[rec.level], rec.prefix, rec.message);
      }
    }
    if (opt_client) {
      npmlog.log('ffdc', opts.clientId, '');
      npmlog.log('ffdc', opts.clientId, 'Client');
      npmlog.log('ffdc', opts.clientId, opt_client);
    }
    if (opt_data) {
      npmlog.log('ffdc', opts.clientId, '');
      npmlog.log('ffdc', opts.clientId, 'Data');
      npmlog.log('ffdc', opts.clientId, opt_data);
    }