Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: pkg/analysis_server/lib/driver.dart

Issue 664743002: Add command-line options for instrumentation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/driver.dart
diff --git a/pkg/analysis_server/lib/driver.dart b/pkg/analysis_server/lib/driver.dart
index e21077732ac3872a0a27716ce25159219601dff3..2f7ae6bf3508ac6fb7d4eb14a760328736e37656 100644
--- a/pkg/analysis_server/lib/driver.dart
+++ b/pkg/analysis_server/lib/driver.dart
@@ -27,20 +27,26 @@ class Driver {
static const BINARY_NAME = 'server';
/**
+ * The name of the option used to enable instrumentation.
+ */
+ static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation";
+
+ /**
* The name of the option used to print usage information.
*/
static const String HELP_OPTION = "help";
/**
- * The name of the option used to specify the port to which the server will
- * connect.
+ * The name of the option used to specify the log file to which
+ * instrumentation data is to be written.
*/
- static const String PORT_OPTION = "port";
+ static const String INSTRUMENTATION_LOG_FILE_OPTION = "instrumentation-log-file";
/**
- * The name of the option used to specify the log file.
+ * The name of the option used to specify the port to which the server will
+ * connect.
*/
- static const String LOG_FILE_OPTION = "log";
+ static const String PORT_OPTION = "port";
/**
* The path to the SDK.
@@ -63,32 +69,31 @@ class Driver {
*/
void start(List<String> args) {
ArgParser parser = new ArgParser();
- parser.addFlag(HELP_OPTION, help:
- "print this help message without starting a server", defaultsTo: false,
+ parser.addFlag(ENABLE_INSTRUMENTATION_OPTION,
+ help: "enable sending instrumentation information to a server",
+ defaultsTo: false,
+ negatable: false);
+ parser.addFlag(HELP_OPTION,
+ help: "print this help message without starting a server",
+ defaultsTo: false,
negatable: false);
- parser.addOption(PORT_OPTION, help:
- "[port] the port on which the server will listen");
- parser.addOption(LOG_FILE_OPTION, help:
- "[path] file to log debugging messages to");
- parser.addOption(SDK_OPTION, help:
- "[path] path to the sdk");
+ parser.addOption(INSTRUMENTATION_LOG_FILE_OPTION,
+ help: "[path] the file to which instrumentation data will be logged");
+ parser.addOption(PORT_OPTION,
+ help: "[port] the port on which the server will listen");
+ parser.addOption(SDK_OPTION,
+ help: "[path] the path to the sdk");
ArgResults results = parser.parse(args);
if (results[HELP_OPTION]) {
_printUsage(parser);
return;
}
- if (results[LOG_FILE_OPTION] != null) {
- try {
- File file = new File(results[LOG_FILE_OPTION]);
- IOSink sink = file.openWrite();
- Logger.root.onRecord.listen((LogRecord record) {
- sink.writeln(record);
- });
- } catch (exception) {
- print('Could not open log file: $exception');
- exitCode = 1;
- return;
+ if (results[ENABLE_INSTRUMENTATION_OPTION]) {
+ if (results[INSTRUMENTATION_LOG_FILE_OPTION] != null) {
+ // Initialize the instrumentation system with logging.
Paul Berry 2014/10/17 15:51:43 Nit: Can we make these TODO comments?
+ } else {
+ // Initialize the instrumentation system without logging.
}
}
int port;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698