Skip to content

Commit

Permalink
Introduce '--raw-logs' option to meteor run to disable logs parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Slava committed Nov 4, 2013
1 parent 21b5e2a commit ac376b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions tools/meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 17 additions & 6 deletions tools/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ac376b6

Please sign in to comment.