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

Side by Side Diff: pkg/analyzer/lib/instrumentation/instrumentation.dart

Issue 816103002: Add InstrumentationService.logPriorityException() and use logException() in refactorings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | 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 instrumentation; 5 library instrumentation;
6 6
7 /** 7 /**
8 * The interface used by client code to communicate with an instrumentation 8 * The interface used by client code to communicate with an instrumentation
9 * server. 9 * server.
10 */ 10 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 * given [instrumentationServer]. 62 * given [instrumentationServer].
63 */ 63 */
64 InstrumentationService(this._instrumentationServer); 64 InstrumentationService(this._instrumentationServer);
65 65
66 /** 66 /**
67 * The current time, expressed as a decimal encoded number of milliseconds. 67 * The current time, expressed as a decimal encoded number of milliseconds.
68 */ 68 */
69 String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString(); 69 String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString();
70 70
71 /** 71 /**
72 * Log that the given [exception] was thrown, with the given [stackTrace]. 72 * Log that the given non-priority [exception] was thrown, with the given
73 * [stackTrace].
73 */ 74 */
74 void logException(dynamic exception, StackTrace stackTrace) { 75 void logException(dynamic exception, StackTrace stackTrace) {
Brian Wilkerson 2014/12/19 22:36:18 We might want to add another parameter that can co
75 if (_instrumentationServer != null) { 76 if (_instrumentationServer != null) {
76 String message = _toString(exception); 77 String message = _toString(exception);
77 String trace = _toString(stackTrace); 78 String trace = _toString(stackTrace);
78 _instrumentationServer.logWithPriority( 79 _instrumentationServer.log('$_timestamp:$TAG_EXCEPTION:$message:$trace');
79 '$_timestamp:$TAG_EXCEPTION:$message:$trace');
80 } 80 }
81 } 81 }
82 82
83 /** 83 /**
84 * Log that a notification has been sent to the client. 84 * Log that a notification has been sent to the client.
85 */ 85 */
86 void logNotification(String notification) { 86 void logNotification(String notification) {
87 _log(TAG_NOTIFICATION, notification); 87 _log(TAG_NOTIFICATION, notification);
88 } 88 }
89 89
90 /** 90 /**
91 * Log that the given priority [exception] was thrown, with the given
92 * [stackTrace].
93 */
94 void logPriorityException(dynamic exception, StackTrace stackTrace) {
95 if (_instrumentationServer != null) {
96 String message = _toString(exception);
97 String trace = _toString(stackTrace);
98 _instrumentationServer.logWithPriority(
99 '$_timestamp:$TAG_EXCEPTION:$message:$trace');
100 }
101 }
102
103 /**
91 * Log that a request has been sent to the client. 104 * Log that a request has been sent to the client.
92 */ 105 */
93 void logRequest(String request) { 106 void logRequest(String request) {
94 _log(TAG_REQUEST, request); 107 _log(TAG_REQUEST, request);
95 } 108 }
96 109
97 /** 110 /**
98 * Log that a response has been sent to the client. 111 * Log that a response has been sent to the client.
99 */ 112 */
100 void logResponse(String response) { 113 void logResponse(String response) {
(...skipping 24 matching lines...) Expand all
125 /** 138 /**
126 * Convert the given [object] to a string. 139 * Convert the given [object] to a string.
127 */ 140 */
128 String _toString(Object object) { 141 String _toString(Object object) {
129 if (object == null) { 142 if (object == null) {
130 return 'null'; 143 return 'null';
131 } 144 }
132 return object.toString(); 145 return object.toString();
133 } 146 }
134 } 147 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698