darkfo
darkfo copied to clipboard
Add global, modularized logging system
Format should be in e.g. "[Module] TYPE: Message"
For example: "[Scripting] WARN: Got bad value for [xxx]"
FWIW, logging/warnings/errors could use console.log
/console.warn
/console.error
.
It's probably going to look something like this:
// At the top level of every module:
const log = Logging.logger("module name");
// ...
log.warn("test: %s", "foo"); // forwarded appropriately to console.warn
We can just take it from another project of mine, rrr, which I modelled in the same style: https://gitlab.com/darkf/rrr/blob/master/src/logging.ts