22 lines
519 B
JavaScript
22 lines
519 B
JavaScript
|
export default {
|
||
|
sinks: new Map(),
|
||
|
logger(sink, enabled=false) {
|
||
|
this.sinks.set(sink, enabled);
|
||
|
return (...args) => {
|
||
|
if (this.sinks.get(sink)) {
|
||
|
console.log(
|
||
|
`%c[${sink}]`,
|
||
|
"color: #8f3f71; font-weight: bold;",
|
||
|
...args
|
||
|
);
|
||
|
}
|
||
|
};
|
||
|
},
|
||
|
enableSink(sink) {
|
||
|
this.sinks.set(sink, true);
|
||
|
},
|
||
|
disableSink(sink) {
|
||
|
this.sinks.set(sink, false);
|
||
|
}
|
||
|
};
|