logger works now outside of react

+ dynamic sample loading logs
+ remove old sampler code
This commit is contained in:
Felix Roos 2022-11-12 11:50:39 +01:00
parent 23e059a065
commit 0b9d59bf0e
7 changed files with 430 additions and 470 deletions

View file

@ -1,3 +1,18 @@
export function logger(message) {
console.log(`%c${message}`, 'background-color: black;color:white;padding:4px;border-radius:15px');
export const logKey = 'strudel.log';
export function logger(message, type, data = {}) {
console.log(`%c${message}`, 'background-color: black;color:white;border-radius:15px');
if (typeof CustomEvent !== 'undefined') {
document.dispatchEvent(
new CustomEvent(logKey, {
detail: {
message,
type,
data,
},
}),
);
}
}
logger.key = logKey;