| 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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 /** | 42 /** |
| 43 * An instrumentation service that will not log any instrumentation data. | 43 * An instrumentation service that will not log any instrumentation data. |
| 44 */ | 44 */ |
| 45 static const InstrumentationService NULL_SERVICE = | 45 static const InstrumentationService NULL_SERVICE = |
| 46 const InstrumentationService(null); | 46 const InstrumentationService(null); |
| 47 | 47 |
| 48 static const String TAG_NOTIFICATION = 'Noti'; | 48 static const String TAG_NOTIFICATION = 'Noti'; |
| 49 static const String TAG_REQUEST = 'Req'; | 49 static const String TAG_REQUEST = 'Req'; |
| 50 static const String TAG_RESPONSE = 'Res'; | 50 static const String TAG_RESPONSE = 'Res'; |
| 51 static const String TAG_VERSION = 'Ver'; | 51 static const String TAG_VERSION = 'Ver'; |
| 52 |
| 52 /** | 53 /** |
| 53 * The instrumentation server used to communicate with the server, or `null` | 54 * The instrumentation server used to communicate with the server, or `null` |
| 54 * if instrumentation data should not be logged. | 55 * if instrumentation data should not be logged. |
| 55 */ | 56 */ |
| 56 final InstrumentationServer instrumentationServer; | 57 final InstrumentationServer instrumentationServer; |
| 57 | 58 |
| 58 /** | 59 /** |
| 59 * Initialize a newly created instrumentation service to comunicate with the | 60 * Initialize a newly created instrumentation service to comunicate with the |
| 60 * given instrumentation server. | 61 * given [instrumentationServer]. |
| 61 */ | 62 */ |
| 62 const InstrumentationService(this.instrumentationServer); | 63 const InstrumentationService(this.instrumentationServer); |
| 63 | 64 |
| 64 /** | 65 /** |
| 65 * The current time, expressed as a decimal encoded number of milliseconds. | 66 * The current time, expressed as a decimal encoded number of milliseconds. |
| 66 */ | 67 */ |
| 67 String get _timestamp => new DateTime.now().millisecond.toString(); | 68 String get _timestamp => new DateTime.now().millisecond.toString(); |
| 68 | 69 |
| 69 /** | 70 /** |
| 70 * Log that a notification has been sent to the client. | 71 * Log that a notification has been sent to the client. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 | 101 |
| 101 /** | 102 /** |
| 102 * Log the given message with the given tag. | 103 * Log the given message with the given tag. |
| 103 */ | 104 */ |
| 104 void _log(String tag, String message) { | 105 void _log(String tag, String message) { |
| 105 if (instrumentationServer != null) { | 106 if (instrumentationServer != null) { |
| 106 instrumentationServer.log('$_timestamp:$tag:$message'); | 107 instrumentationServer.log('$_timestamp:$tag:$message'); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 } | 110 } |
| OLD | NEW |