Chromium Code Reviews| 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) { |