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

Unified Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 196373003: Change in the Dart command line analyzer, Logger.logError takes a String, not Error types. This wi… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
Index: pkg/analyzer/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer/lib/src/analyzer_impl.dart b/pkg/analyzer/lib/src/analyzer_impl.dart
index aff85fb29043c605d5dd0863c8c03f766a1ffc17..2dac98e314b6affee2cf01ff046bab6ad4c1e936 100644
--- a/pkg/analyzer/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer/lib/src/analyzer_impl.dart
@@ -125,7 +125,7 @@ class AnalyzerImpl {
stdout.writeln("total:$totalTime");
}
}).catchError((exception, stackTrace) {
- AnalysisEngine.instance.logger.logError(exception);
+ AnalysisEngine.instance.logger.logError(exception.toString());
});
}
@@ -158,6 +158,8 @@ class AnalyzerImpl {
sourceFactory = new SourceFactory(resolvers);
context = AnalysisEngine.instance.createAnalysisContext();
context.sourceFactory = sourceFactory;
+ // Uncomment the following to have errors reported on stdout and stderr
+// AnalysisEngine.instance.logger = new StdLogger();
jwren 2014/03/11 23:53:37 Do we want an additional --verbose flag to enable
Brian Wilkerson 2014/03/12 13:19:18 I would probably call it "--debug", but it seems l
jwren 2014/03/12 16:28:44 Will add the flag in a follow up CL.
// set options for context
AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
@@ -259,3 +261,30 @@ class AnalyzerImpl {
return UriKind.FILE_URI;
}
}
+
+/**
+ * This [Logger] prints out information comments to [stdout] and error messages
+ * to [stderr].
+ */
+class StdLogger extends Logger {
+
+ @override
+ void logError(String message) {
+ stderr.writeln(message);
+ }
+
+ @override
+ void logError2(String message, Exception exception) {
+ stderr.writeln(message);
+ }
+
+ @override
+ void logInformation(String message) {
+ stdout.writeln(message);
+ }
+
+ @override
+ void logInformation2(String message, Exception exception) {
+ stdout.writeln(message);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698