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

Side by Side Diff: packages/analyzer/lib/src/generated/incremental_logger.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 months 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
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 engine.incremental_logger; 5 library analyzer.src.generated.incremental_logger;
6 6
7 /** 7 /**
8 * The shared instance of [Logger] used by several incremental resolution 8 * The shared instance of [Logger] used by several incremental resolution
9 * classes. It is initialized externally by the Analysis Engine client. 9 * classes. It is initialized externally by the Analysis Engine client.
10 */ 10 */
11 Logger logger = NULL_LOGGER; 11 Logger logger = NULL_LOGGER;
12 12
13 /** 13 /**
14 * An instance of [Logger] that does not print anything. 14 * An instance of [Logger] that does not print anything.
15 */ 15 */
(...skipping 17 matching lines...) Expand all
33 * Mark an exit from the current sections, logs the duration. 33 * Mark an exit from the current sections, logs the duration.
34 */ 34 */
35 void exit(); 35 void exit();
36 36
37 /** 37 /**
38 * Logs the given [obj]. 38 * Logs the given [obj].
39 */ 39 */
40 void log(Object obj); 40 void log(Object obj);
41 41
42 /** 42 /**
43 * Logs the given [exception] and [stackTrace].
44 */
45 void logException(Object exception, [Object stackTrace]);
46
47 /**
43 * Starts a new timer. 48 * Starts a new timer.
44 */ 49 */
45 LoggingTimer startTimer(); 50 LoggingTimer startTimer();
46 } 51 }
47 52
48 /** 53 /**
49 * The handle of a timer. 54 * The handle of a timer.
50 */ 55 */
51 class LoggingTimer { 56 class LoggingTimer {
52 final Logger _logger; 57 final Logger _logger;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 @override 100 @override
96 void log(Object obj) { 101 void log(Object obj) {
97 DateTime now = new DateTime.now(); 102 DateTime now = new DateTime.now();
98 String indent = _section.indent; 103 String indent = _section.indent;
99 String objStr = _getObjectString(obj); 104 String objStr = _getObjectString(obj);
100 String line = '[$now] $indent$objStr'; 105 String line = '[$now] $indent$objStr';
101 _sink.writeln(line); 106 _sink.writeln(line);
102 } 107 }
103 108
104 @override 109 @override
110 void logException(Object exception, [Object stackTrace]) {
111 if (exception != null) {
112 log(exception);
113 }
114 if (stackTrace != null) {
115 log(stackTrace);
116 }
117 }
118
119 @override
105 LoggingTimer startTimer() { 120 LoggingTimer startTimer() {
106 return new LoggingTimer(this); 121 return new LoggingTimer(this);
107 } 122 }
108 123
109 String _getObjectString(Object obj) { 124 String _getObjectString(Object obj) {
110 if (obj == null) { 125 if (obj == null) {
111 return 'null'; 126 return 'null';
112 } 127 }
113 if (obj is Function) { 128 if (obj is Function) {
114 obj = obj(); 129 obj = obj();
(...skipping 25 matching lines...) Expand all
140 @override 155 @override
141 void enter(String name) {} 156 void enter(String name) {}
142 157
143 @override 158 @override
144 void exit() {} 159 void exit() {}
145 160
146 @override 161 @override
147 void log(Object obj) {} 162 void log(Object obj) {}
148 163
149 @override 164 @override
165 void logException(Object exception, [Object stackTrace]) {}
166
167 @override
150 LoggingTimer startTimer() { 168 LoggingTimer startTimer() {
151 return new LoggingTimer(this); 169 return new LoggingTimer(this);
152 } 170 }
153 } 171 }
154 172
155 /** 173 /**
156 * A [StringSink] implementation that uses `print`. 174 * A [StringSink] implementation that uses `print`.
157 */ 175 */
158 class _PrintStringSink implements StringSink { 176 class _PrintStringSink implements StringSink {
159 String _line = ''; 177 String _line = '';
(...skipping 17 matching lines...) Expand all
177 _line += new String.fromCharCode(charCode); 195 _line += new String.fromCharCode(charCode);
178 } 196 }
179 197
180 @override 198 @override
181 void writeln([Object obj = '']) { 199 void writeln([Object obj = '']) {
182 _line += obj; 200 _line += obj;
183 print(_line); 201 print(_line);
184 _line = ''; 202 _line = '';
185 } 203 }
186 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698