darkfo icon indicating copy to clipboard operation
darkfo copied to clipboard

Add global, modularized logging system

Open darkf opened this issue 7 years ago • 2 comments

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 avatar Feb 02 '17 08:02 darkf

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 avatar Feb 02 '17 15:02 darkf

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

darkf avatar Nov 25 '17 21:11 darkf