Given the following situation: A Node.js express app with some routes and modules
app.js
/routes
|-user.js
|-login.js
|-e.t.c.
/modules
|-logger.js
Let's say that all the routes need the logger to do proper error handling and logging. Would it be better to include the logger in all the routes or only in app.js and then inject the logger object into the routes?
The latter would seem to be less resource heavy because the object only gets created once, but is this the case?