How to use the pm2.streamLogs function in pm2

To help you get started, we’ve selected a few pm2 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 expo / exp / build / commands / logs.js View on Github external
runAsync: _asyncToGenerator(function* (env) {
    var argv = env.argv;
    var args = argv._;

    yield pm2serve.setupServeAsync(env);
    var pm2Id = yield config.expInfoFile.getAsync('pm2Id', null);
    if (!pm2Id) {
      throw CommandError('NO_PM2_ID', env, "I can't find a server; try running `exp start` first.");
    }

    var lines = argv.lines || 50;

    log("Use Ctrl-C to stop streaming logs");

    yield pm2.promise.connect();
    pm2.streamLogs(pm2Id, lines, !!argv.raw);
  })
};
github anthillsolutions / api-skel / gulpfile.js View on Github external
}, function() {
      pm2.streamLogs('all', 0);
    });
  });
github expo / exp / src / commands / logs.js View on Github external
async function action(projectDir, options) {
  await pm2serve.setupServeAsync(projectDir);
  var pm2Id = await config.projectExpJsonFile(projectDir).getAsync('pm2Id', null);
  if (pm2Id == null) {
    throw CommandError('NO_PM2_ID', "I can't find a server; try running `exp start` first.");
  }

  var lines = options.lines || 50;

  log("Use Ctrl-C to stop streaming logs");

  await pm2.promise.connect();
  pm2.streamLogs(pm2Id, lines, !!options.raw);
}