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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_logger.dart

Issue 694833002: Fix logging API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | pkg/analyzer/test/generated/utilities_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698