I am working on logging helper (in Node.JS) witch have few exported functions (error, warn, etc...)
.
I have for example two other scripts what using this my "module": test1, test2
I need when I initialize my logging module (let log = require("./log.js");
) in both scripts to get error messages like this: [time][ERROR][TEST1] actual message...
I can use non-singleton approach and add constructor to my logging module what will take TEST1
so every script can have his own logger.
But when there will be 100 scripts using logger, there will also be 100 logger instances.
So is there better approach to get same result, every file CAN have his own defined prefix?