I think there needs to be a simple "uber-formatting" plugin that has a couple of pre-canned options but that provides a set of great out-of-the-box formatting options. Some suggestions for features this plugin would provide are:
- Automatic prefixing of namespace + log level in the output, with the option to have one or both showing (via an enum).
- Automatic coloring of the output based on a couple of coloring options (via an enum).
- Optional timer output, showing the number of ms / s / mins between this and last log output.
I would also suggesting doing some more research to see what other options might be helpful.
I think the transform interface might look something like this:
type UberFormatOptions = {
prefixing: "none" | "level" | "namespace" | "all";
coloring: "none" | "level" | "namespace";
timing: "none" | "timestamp" | "stopwatch";
};
function UberFormatter(options: Readonly<UberFormatOptions>) {}
// used as follows
Scribe.transform = UberFormatter({
prefixing: "all",
coloring: "namespace",
timing: "stopwatch"
});
const log = Scribe.getLog("myapp:MyModule");
log.debug("a message", data");
I think there needs to be a simple "uber-formatting" plugin that has a couple of pre-canned options but that provides a set of great out-of-the-box formatting options. Some suggestions for features this plugin would provide are:
I would also suggesting doing some more research to see what other options might be helpful.
I think the transform interface might look something like this: