| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 logging_page; | 5 library logging_page; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (container == null) { | 149 if (container == null) { |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 // Adjust scroll so that the bottom of the content is visible. | 152 // Adjust scroll so that the bottom of the content is visible. |
| 153 container.scrollTop = container.scrollHeight - container.clientHeight; | 153 container.scrollTop = container.scrollHeight - container.clientHeight; |
| 154 } | 154 } |
| 155 | 155 |
| 156 _flushPendingLogs() { | 156 _flushPendingLogs() { |
| 157 DivElement logContainer = shadowRoot.querySelector(_kLogSelector); | 157 DivElement logContainer = shadowRoot.querySelector(_kLogSelector); |
| 158 bool autoScroll = _isScrolledToBottom(logContainer); | 158 bool autoScroll = _isScrolledToBottom(logContainer); |
| 159 var lastElement; | |
| 160 for (var logRecord in pendingLogRecords) { | 159 for (var logRecord in pendingLogRecords) { |
| 161 lastElement = _renderAppend(logRecord); | 160 _renderAppend(logRecord); |
| 162 } | 161 } |
| 163 if (autoScroll) { | 162 if (autoScroll) { |
| 164 _scrollToBottom(logContainer); | 163 _scrollToBottom(logContainer); |
| 165 } | 164 } |
| 166 pendingLogRecords.clear(); | 165 pendingLogRecords.clear(); |
| 167 } | 166 } |
| 168 | 167 |
| 169 _onEvent(ServiceEvent event) { | 168 _onEvent(ServiceEvent event) { |
| 170 assert(event.kind == Isolate.kLoggingStream); | 169 assert(event.kind == Isolate.kLoggingStream); |
| 171 _append(event.logRecord); | 170 _append(event.logRecord); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 193 | 192 |
| 194 @observable Isolate isolate; | 193 @observable Isolate isolate; |
| 195 @observable String severityLevel; | 194 @observable String severityLevel; |
| 196 int _severityLevelValue = 0; | 195 int _severityLevelValue = 0; |
| 197 int _maxLevelLabelLength = 0; | 196 int _maxLevelLabelLength = 0; |
| 198 Future<StreamSubscription> _loggingSubscriptionFuture; | 197 Future<StreamSubscription> _loggingSubscriptionFuture; |
| 199 StreamSubscription _resizeSubscription; | 198 StreamSubscription _resizeSubscription; |
| 200 final List<Map> logRecords = new List<Map>(); | 199 final List<Map> logRecords = new List<Map>(); |
| 201 final List<Map> pendingLogRecords = new List<Map>(); | 200 final List<Map> pendingLogRecords = new List<Map>(); |
| 202 } | 201 } |
| OLD | NEW |