Hi guys.
Sorry if this has been asked before, or is exceptionally simple to figure out.
In my app I have, say, three components, main.js, a.js and b.js. main.js requires both a.js and b.js, and a.js also requires b.js.
I am implementing proper logging for this app. So in main.js I setup a bunyan logger, and when I require modules I send in a child logger for each of them. So from main, a and b are required with each their child logger. But what do I do when a requires b?
- Do I create a child logger in a and give it to b?
- Do I inject the 'instance' of b that was initialized in main.js into a?
I'm just struggling to find the best way of structuring this. Perhaps the best way is rethinking the architecture. Any help is much appreciated.
Thanks,
Mats