Add Logger class
This commit is contained in:
parent
959f75d55c
commit
e0578d425d
1 changed files with 22 additions and 0 deletions
22
module/utils/Logger.mjs
Normal file
22
module/utils/Logger.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
const augmentedProps = new Set([
|
||||||
|
`debug`,
|
||||||
|
`log`,
|
||||||
|
`error`,
|
||||||
|
`info`,
|
||||||
|
`warn`,
|
||||||
|
`group`,
|
||||||
|
`time`,
|
||||||
|
`timeEnd`,
|
||||||
|
`timeLog`,
|
||||||
|
`timeStamp`,
|
||||||
|
]);
|
||||||
|
|
||||||
|
/** @type {Console} */
|
||||||
|
export const Logger = new Proxy(console, {
|
||||||
|
get(target, prop, _receiver) {
|
||||||
|
if (augmentedProps.has(prop)) {
|
||||||
|
return target[prop].bind(target, game.system.id, `|`);
|
||||||
|
};
|
||||||
|
return target[prop];
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue