mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 15:30:00 -04:00
Fallback for when function name isn't in stack
This commit is contained in:
parent
7bae982c2f
commit
ca427c830c
1 changed files with 11 additions and 16 deletions
27
src/log.ts
27
src/log.ts
|
@ -15,8 +15,7 @@ export default {
|
||||||
fmt += `${stack[i].getFunctionName()} -> ` + fmt;
|
fmt += `${stack[i].getFunctionName()} -> ` + fmt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt += stack[0].getFunctionName() || "Anonymous";
|
||||||
fmt += stack[0].getFunctionName();
|
|
||||||
|
|
||||||
return fmt;
|
return fmt;
|
||||||
};
|
};
|
||||||
|
@ -52,20 +51,16 @@ export default {
|
||||||
}[severity];
|
}[severity];
|
||||||
|
|
||||||
fn(
|
fn(
|
||||||
`%c${fmt}%c ${message}`,
|
`%c${fmt}%c ${message}`,
|
||||||
`
|
`
|
||||||
background-color: ${bg};
|
background-color: ${bg};
|
||||||
color: ${fg};
|
color: ${fg};
|
||||||
padding: ${padding}px;
|
padding: ${padding}px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
`,
|
`,
|
||||||
`
|
`${severity === "debug" ? "color: gray" : ""}`, ...args);
|
||||||
${severity === "debug" ? "color: gray" : ""}
|
|
||||||
`,
|
|
||||||
...args
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
log: function (message: string, ...args: any[]) {
|
log: function (message: string, ...args: any[]) {
|
||||||
this.fmt("log", message, ...args);
|
this.fmt("log", message, ...args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue