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

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

Issue 1432423004: Send any logError() information to the IDE. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add messages for all sendServerErrorNotification() invocations. Created 5 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/analysis_server.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:analysis_server/src/analysis_server.dart';
7 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/java_engine.dart'; 9 import 'package:analyzer/src/generated/java_engine.dart';
9 import 'package:logging/logging.dart' as logging; 10 import 'package:logging/logging.dart' as logging;
10 11
11 /** 12 /**
12 * Instances of the class [AnalysisLogger] translate from the analysis engine's 13 * Instances of the class [AnalysisLogger] translate from the analysis engine's
13 * API to the logging package's API. 14 * API to the logging package's API.
14 */ 15 */
15 class AnalysisLogger implements Logger { 16 class AnalysisLogger implements Logger {
16 /** 17 /**
17 * The underlying logger that is being wrapped. 18 * The underlying logger that is being wrapped.
18 */ 19 */
19 final logging.Logger baseLogger = new logging.Logger('analysis.server'); 20 final logging.Logger baseLogger = new logging.Logger('analysis.server');
20 21
21 AnalysisLogger() { 22 /**
23 * The analysis server that is using this logger.
24 */
25 final AnalysisServer server;
26
27 AnalysisLogger(this.server) {
28 assert(server != null);
22 logging.Logger.root.onRecord.listen((logging.LogRecord record) { 29 logging.Logger.root.onRecord.listen((logging.LogRecord record) {
23 AnalysisEngine.instance.instrumentationService.logLogEntry( 30 AnalysisEngine.instance.instrumentationService.logLogEntry(
24 record.level.name, 31 record.level.name,
25 record.time, 32 record.time,
26 record.message, 33 record.message,
27 record.error, 34 record.error,
28 record.stackTrace); 35 record.stackTrace);
29 }); 36 });
30 } 37 }
31 38
32 @override 39 @override
33 void logError(String message, [CaughtException exception]) { 40 void logError(String message, [CaughtException exception]) {
34 if (exception == null) { 41 if (exception == null) {
35 baseLogger.severe(message); 42 baseLogger.severe(message);
36 } else { 43 } else {
37 baseLogger.severe(message, exception.exception, exception.stackTrace); 44 baseLogger.severe(message, exception.exception, exception.stackTrace);
38 } 45 }
46 server.sendServerErrorNotification(
47 message, exception, exception?.stackTrace);
39 } 48 }
40 49
41 @override 50 @override
42 void logError2(String message, Object exception) { 51 void logError2(String message, Object exception) {
43 baseLogger.severe(message, exception); 52 baseLogger.severe(message, exception);
44 } 53 }
45 54
46 @override 55 @override
47 void logInformation(String message, [CaughtException exception]) { 56 void logInformation(String message, [CaughtException exception]) {
48 if (exception == null) { 57 if (exception == null) {
49 baseLogger.info(message); 58 baseLogger.info(message);
50 } else { 59 } else {
51 baseLogger.info(message, exception.exception, exception.stackTrace); 60 baseLogger.info(message, exception.exception, exception.stackTrace);
52 } 61 }
53 } 62 }
54 63
55 @override 64 @override
56 void logInformation2(String message, Object exception) { 65 void logInformation2(String message, Object exception) {
57 baseLogger.info(message, exception); 66 baseLogger.info(message, exception);
58 } 67 }
59 } 68 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/analysis_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698