| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of polymer; | 5 part of polymer; |
| 6 | 6 |
| 7 /// Annotation used to automatically register polymer elements. | 7 /// Annotation used to automatically register polymer elements. |
| 8 class CustomTag { | 8 class CustomTag { |
| 9 final String tagName; | 9 final String tagName; |
| 10 const CustomTag(this.tagName); | 10 const CustomTag(this.tagName); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (proto is Node) proto = new JsObject.fromBrowserObject(proto); | 136 if (proto is Node) proto = new JsObject.fromBrowserObject(proto); |
| 137 return proto; | 137 return proto; |
| 138 }(); | 138 }(); |
| 139 | 139 |
| 140 // Add support for the polymer js style of enabling logging. The global logging | 140 // Add support for the polymer js style of enabling logging. The global logging |
| 141 // level is respected for specified loggers (see http://goo.gl/btfDe1). All | 141 // level is respected for specified loggers (see http://goo.gl/btfDe1). All |
| 142 // other loggers will be set to [Level.OFF]. Logs will also be printed to the | 142 // other loggers will be set to [Level.OFF]. Logs will also be printed to the |
| 143 // console automatically if any are supplied. | 143 // console automatically if any are supplied. |
| 144 void _initializeLogging() { | 144 void _initializeLogging() { |
| 145 hierarchicalLoggingEnabled = true; | 145 hierarchicalLoggingEnabled = true; |
| 146 var logFlags = js.context['logFlags']; | 146 var webComponents = js.context['WebComponents']; |
| 147 var logFlags = (webComponents == null || webComponents['flags'] == null) ? {} |
| 148 : webComponents['flags']['log']; |
| 147 if (logFlags == null) logFlags = {}; | 149 if (logFlags == null) logFlags = {}; |
| 148 var loggers = | 150 var loggers = |
| 149 [_observeLog, _eventsLog, _unbindLog, _bindLog, _watchLog, _readyLog]; | 151 [_observeLog, _eventsLog, _unbindLog, _bindLog, _watchLog, _readyLog]; |
| 150 var polymerLogger = new Logger('polymer'); | 152 var polymerLogger = new Logger('polymer'); |
| 151 | 153 |
| 152 // If no loggers specified then disable globally and return. | 154 // If no loggers specified then disable globally and return. |
| 153 if (!loggers.any((logger) => logFlags[logger.name] == true)) { | 155 if (!loggers.any((logger) => logFlags[logger.name] == true)) { |
| 154 polymerLogger.level = Level.OFF; | 156 polymerLogger.level = Level.OFF; |
| 155 return; | 157 return; |
| 156 } | 158 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 183 // Only alert once per waiting state. | 185 // Only alert once per waiting state. |
| 184 if (lastAlert == lastWaiting) return; | 186 if (lastAlert == lastWaiting) return; |
| 185 lastAlert = lastWaiting; | 187 lastAlert = lastWaiting; |
| 186 | 188 |
| 187 print('No elements registered in a while, but still waiting on ' | 189 print('No elements registered in a while, but still waiting on ' |
| 188 '${waiting.length} elements to be registered. Check that you have a ' | 190 '${waiting.length} elements to be registered. Check that you have a ' |
| 189 'class with an @CustomTag annotation for each of the following tags: ' | 191 'class with an @CustomTag annotation for each of the following tags: ' |
| 190 '${waiting.map((e) => "'${e.attributes['name']}'").join(', ')}'); | 192 '${waiting.map((e) => "'${e.attributes['name']}'").join(', ')}'); |
| 191 }); | 193 }); |
| 192 } | 194 } |
| OLD | NEW |