darkf / darkfo

DarkFO, a post-nuclear RPG remake (of Fallout 2)
Apache License 2.0
135 stars 12 forks source link

Add global, modularized logging system #81

Open darkf opened 7 years ago

darkf commented 7 years ago

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 7 years ago

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 6 years ago

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