| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis.logger; | 5 library analysis.logger; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
| 8 import 'package:logging/logging.dart' as logging; | 8 import 'package:logging/logging.dart' as logging; |
| 9 import 'package:analyzer/src/generated/java_engine.dart'; |
| 9 | 10 |
| 10 /** | 11 /** |
| 11 * Instances of the class [AnalysisLogger] translate from the analysis engine's | 12 * Instances of the class [AnalysisLogger] translate from the analysis engine's |
| 12 * API to the logging package's API. | 13 * API to the logging package's API. |
| 13 */ | 14 */ |
| 14 class AnalysisLogger implements Logger { | 15 class AnalysisLogger implements Logger { |
| 15 /** | 16 /** |
| 16 * The underlying logger that is being wrapped. | 17 * The underlying logger that is being wrapped. |
| 17 */ | 18 */ |
| 18 final logging.Logger baseLogger = new logging.Logger('analysis.server'); | 19 final logging.Logger baseLogger = new logging.Logger('analysis.server'); |
| 19 | 20 |
| 20 @override | 21 @override |
| 21 void logError(String message) { | 22 void logError(String message, [CaughtException exception]) { |
| 22 baseLogger.severe(message); | 23 if (exception == null) { |
| 24 baseLogger.severe(message); |
| 25 } else { |
| 26 baseLogger.severe(message, exception.exception, exception.stackTrace); |
| 27 } |
| 23 } | 28 } |
| 24 | 29 |
| 25 @override | 30 @override |
| 26 void logError2(String message, Exception exception) { | 31 void logError2(String message, Object exception) { |
| 27 baseLogger.severe(message, exception); | 32 baseLogger.severe(message, exception); |
| 28 } | 33 } |
| 29 | 34 |
| 30 @override | 35 @override |
| 31 void logInformation(String message) { | 36 void logInformation(String message, [CaughtException exception]) { |
| 32 baseLogger.info(message); | 37 if (exception == null) { |
| 38 baseLogger.info(message); |
| 39 } else { |
| 40 baseLogger.info(message, exception.exception, exception.stackTrace); |
| 41 } |
| 33 } | 42 } |
| 34 | 43 |
| 35 @override | 44 @override |
| 36 void logInformation2(String message, Exception exception) { | 45 void logInformation2(String message, Object exception) { |
| 37 baseLogger.info(message, exception); | 46 baseLogger.info(message, exception); |
| 38 } | 47 } |
| 39 } | 48 } |
| OLD | NEW |