Skip to content

Commit 12dd377

Browse files
author
Steven Orvell
committed
collapse mixins:
remove logging; folded into legacy-element remove event-listeners and annotations; folded into element.
1 parent 4153d28 commit 12dd377

8 files changed

+425
-551
lines changed

src/legacy/legacy-element.html

+34-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<link rel="import" href="../lib/async-render.html">
1515
<link rel="import" href="../lib/unresolved.html">
1616
<link rel="import" href="polymer.dom.html">
17-
<link rel="import" href="logging.html">
1817

1918
<script>
2019
(function() {
@@ -23,10 +22,12 @@
2322

2423
var utils = Polymer.Utils;
2524

25+
const hasColor = (window.chrome && !(/edge/i.test(navigator.userAgent))) || (/firefox/i.test(navigator.userAgent));
26+
const prefix = hasColor ? ['%c[%s::%s]:', 'font-weight: bold; background-color:#EEEE00;'] : ['[%s::%s]:'];
27+
2628
Polymer.LegacyElementMixin = Polymer.Utils.dedupingMixin(function(base) {
2729

28-
const mixin = Polymer.Logging(
29-
Polymer.GestureEventListeners(Polymer.ElementMixin(base)));
30+
const mixin = Polymer.GestureEventListeners(Polymer.ElementMixin(base));
3031

3132
return class LegacyElement extends mixin {
3233

@@ -711,6 +712,36 @@
711712
return null;
712713
}
713714

715+
// logging
716+
_logger(level, args) {
717+
// accept ['foo', 'bar'] and [['foo', 'bar']]
718+
if (Array.isArray(args) && args.length === 1) {
719+
args = args[0];
720+
}
721+
switch(level) {
722+
case 'log':
723+
case 'warn':
724+
case 'error':
725+
console[level](...args);
726+
}
727+
}
728+
729+
_log(...args) {
730+
this._logger('log', args);
731+
}
732+
733+
_warn(...args) {
734+
this._logger('warn', args);
735+
}
736+
737+
_error(...args) {
738+
this._logger('error', args)
739+
}
740+
741+
_logf(...args) {
742+
return prefix.concat(this.is).concat(args);
743+
}
744+
714745
}
715746

716747
});

src/legacy/logging.html

-46
This file was deleted.

0 commit comments

Comments
 (0)