logger = ({
log() {
console.log(...arguments);
return this;
},
logMsg(msg) {
console.log(msg);
return this;
},
logSel() {
console.log(this);
return this;
},
logAttr(name) {
this.each(function(d, i) {
let attr = d3.select(this).attr(name);
console.log(`Node ${i}: ${name}=${attr}`);
});
return this;
},
logData() {
console.log(this.data());
return this;
},
logNodeData() {
this.each(function(d, i) {
console.log(`Node ${i}: ${d}`);
});
return this;
}
});