| 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:analyzer/src/generated/java_engine.dart'; | 8 import 'package:analyzer/src/generated/java_engine.dart'; | 
| 9 import 'package:logging/logging.dart' as logging; | 9 import 'package:logging/logging.dart' as logging; | 
| 10 | 10 | 
| 11 /** | 11 /** | 
| 12  * Instances of the class [AnalysisLogger] translate from the analysis engine's | 12  * Instances of the class [AnalysisLogger] translate from the analysis engine's | 
| 13  * API to the logging package's API. | 13  * API to the logging package's API. | 
| 14  */ | 14  */ | 
| 15 class AnalysisLogger implements Logger { | 15 class AnalysisLogger implements Logger { | 
| 16   /** | 16   /** | 
| 17    * The underlying logger that is being wrapped. | 17    * The underlying logger that is being wrapped. | 
| 18    */ | 18    */ | 
| 19   final logging.Logger baseLogger = new logging.Logger('analysis.server'); | 19   final logging.Logger baseLogger = new logging.Logger('analysis.server'); | 
| 20 | 20 | 
| 21   AnalysisLogger() { | 21   AnalysisLogger() { | 
| 22     logging.Logger.root.onRecord.listen((logging.LogRecord record) { | 22     logging.Logger.root.onRecord.listen((logging.LogRecord record) { | 
| 23       AnalysisEngine.instance.instrumentationService.logLogEntry( | 23       AnalysisEngine.instance.instrumentationService.logLogEntry( | 
| 24           record.level.name, record.time, record.message, record.error, record.s
    tackTrace); | 24           record.level.name, | 
|  | 25           record.time, | 
|  | 26           record.message, | 
|  | 27           record.error, | 
|  | 28           record.stackTrace); | 
| 25     }); | 29     }); | 
| 26   } | 30   } | 
| 27 | 31 | 
| 28   @override | 32   @override | 
| 29   void logError(String message, [CaughtException exception]) { | 33   void logError(String message, [CaughtException exception]) { | 
| 30     if (exception == null) { | 34     if (exception == null) { | 
| 31       baseLogger.severe(message); | 35       baseLogger.severe(message); | 
| 32     } else { | 36     } else { | 
| 33       baseLogger.severe(message, exception.exception, exception.stackTrace); | 37       baseLogger.severe(message, exception.exception, exception.stackTrace); | 
| 34     } | 38     } | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 46     } else { | 50     } else { | 
| 47       baseLogger.info(message, exception.exception, exception.stackTrace); | 51       baseLogger.info(message, exception.exception, exception.stackTrace); | 
| 48     } | 52     } | 
| 49   } | 53   } | 
| 50 | 54 | 
| 51   @override | 55   @override | 
| 52   void logInformation2(String message, Object exception) { | 56   void logInformation2(String message, Object exception) { | 
| 53     baseLogger.info(message, exception); | 57     baseLogger.info(message, exception); | 
| 54   } | 58   } | 
| 55 } | 59 } | 
| OLD | NEW | 
|---|