Add global, modularized logging system
darkf opened this issue · 2 comments
darkf commented
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.
darkf commented
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
darkf commented
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