Introduce '--raw-logs' option to meteor run to disable logs parsing.

This commit is contained in:
Slava Kim
2013-11-03 22:09:17 -08:00
committed by Emily Stark
parent 6ef6b2954e
commit 784bcbbbb7
2 changed files with 20 additions and 6 deletions

View File

@@ -367,6 +367,8 @@ Fiber(function () {
.describe('port', 'Port to listen on. NOTE: Also uses port N+1 and N+2.')
.boolean('production')
.describe('production', 'Run in production mode. Minify and bundle CSS and JS files.')
.boolean('raw-logs')
.describe('raw-logs', 'Run without parsing logs from stdout and stderr.')
.describe('settings', 'Set optional data for Meteor.settings on the server')
.describe('release', 'Specify the release of Meteor to use')
.describe('program', 'The program in the app to run (Advanced)')
@@ -394,6 +396,7 @@ Fiber(function () {
maybePrintUserOverrideMessage();
runner.run(context, {
port: argv.port,
rawLogs: argv['raw-logs'],
minify: argv.production,
once: argv.once,
settingsFile: argv.settings,

View File

@@ -303,16 +303,26 @@ var startServer = function (options) {
return;
}
var obj = Log.parse(line) || Log.objFromText(line);
console.log(Log.format(obj, { color:true }));
saveLog({stdout: Log.format(obj)});
if (options.rawLogs) {
console.log(line);
saveLog({stdout: line});
} else {
var obj = Log.parse(line) || Log.objFromText(line);
console.log(Log.format(obj, { color:true }));
saveLog({stdout: Log.format(obj)});
}
});
eachline(proc.stderr, 'utf8', function (line) {
if (!line) return;
var obj = Log.objFromText(line, { level: 'warn', stderr: true });
console.log(Log.format(obj, { color: true }));
saveLog({stderr: Log.format(obj)});
if (options.rawLogs) {
console.error(line);
saveLog({stderr: line});
} else {
var obj = Log.objFromText(line, { level: 'warn', stderr: true });
console.log(Log.format(obj, { color: true }));
saveLog({stderr: Log.format(obj)});
}
});
proc.on('close', function (code, signal) {
@@ -555,6 +565,7 @@ exports.run = function (context, options) {
mongoUrl: mongoUrl,
rootUrl: rootUrl,
library: context.library,
rawLogs: options.rawLogs,
onExit: function (code) {
// on server exit
Status.running = false;