Chromium Code Reviews| Index: pkg/analysis_server/lib/src/analysis_logger.dart |
| diff --git a/pkg/analysis_server/lib/src/analysis_logger.dart b/pkg/analysis_server/lib/src/analysis_logger.dart |
| index 9e751a42661dde5c5ca733094661778af6d935ad..388c98eb3185ab48b77a306b3a83b40db3e3c66f 100644 |
| --- a/pkg/analysis_server/lib/src/analysis_logger.dart |
| +++ b/pkg/analysis_server/lib/src/analysis_logger.dart |
| @@ -8,6 +8,8 @@ import 'package:analyzer/src/generated/engine.dart'; |
| import 'package:analyzer/src/generated/java_engine.dart'; |
| import 'package:logging/logging.dart' as logging; |
| +typedef LogMessageHandler(String message, CaughtException exception); |
| + |
| /** |
| * Instances of the class [AnalysisLogger] translate from the analysis engine's |
| * API to the logging package's API. |
| @@ -18,7 +20,12 @@ class AnalysisLogger implements Logger { |
| */ |
| final logging.Logger baseLogger = new logging.Logger('analysis.server'); |
| - AnalysisLogger() { |
| + /** |
| + * This handler is invoked for every [logError] invocation. |
| + */ |
| + final LogMessageHandler onError; |
| + |
| + AnalysisLogger({this.onError}) { |
|
Brian Wilkerson
2015/11/12 14:52:51
I'm not sure we need this level of flexibility. Se
scheglov
2015/11/12 16:15:56
Done.
|
| logging.Logger.root.onRecord.listen((logging.LogRecord record) { |
| AnalysisEngine.instance.instrumentationService.logLogEntry( |
| record.level.name, |
| @@ -31,6 +38,9 @@ class AnalysisLogger implements Logger { |
| @override |
| void logError(String message, [CaughtException exception]) { |
| + if (onError != null) { |
| + onError(message, exception); |
| + } |
| if (exception == null) { |
| baseLogger.severe(message); |
| } else { |