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

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

Issue 360973002: Add a "--log" option to analysis server to dump log messages to a file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 78d198f3ff231a90fe9ffe98820a029b936171de..c3c6f24ab34a78305f4b7d5f277cfb13bbfd6f35 100644
--- a/pkg/analysis_server/lib/driver.dart
+++ b/pkg/analysis_server/lib/driver.dart
@@ -10,6 +10,7 @@ import 'package:analysis_server/http_server.dart';
import 'package:analysis_server/src/socket_server.dart';
import 'package:analysis_server/stdio_server.dart';
import 'package:args/args.dart';
+import 'package:logging/logging.dart';
/**
* The [Driver] class represents a single running instance of the analysis
@@ -33,6 +34,11 @@ class Driver {
*/
static const String PORT_OPTION = "port";
+ /**
+ * The name of the option used to specify the log file.
+ */
+ static const String LOG_FILE_OPTION = "log";
+
SocketServer socketServer = new SocketServer();
HttpAnalysisServer httpServer;
@@ -54,12 +60,27 @@ class Driver {
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");
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);
Brian Wilkerson 2014/07/01 17:30:01 Where do we close the file?
Paul Berry 2014/07/01 17:51:12 We just let the OS close it for us when the proces
+ });
+ } catch (exception) {
+ print('Could not open log file: $exception');
+ exitCode = 1;
+ return;
+ }
+ }
int port;
bool serve_http = false;
if (results[PORT_OPTION] != null) {
« 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