{"action":"created","issue":{"url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/13","repository_url":"https://api.github.com/repos/talyssonoc/awilix-express","labels_url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/13/comments","events_url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/13/events","html_url":"https://github.com/talyssonoc/awilix-express/issues/13","id":335982650,"node_id":"MDU6SXNzdWUzMzU5ODI2NTA=","number":13,"title":"Scoped logger per request?","user":{"login":"guumaster","id":765396,"node_id":"MDQ6VXNlcjc2NTM5Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/765396?v=4","gravatar_id":"","url":"https://api.github.com/users/guumaster","html_url":"https://github.com/guumaster","followers_url":"https://api.github.com/users/guumaster/followers","following_url":"https://api.github.com/users/guumaster/following{/other_user}","gists_url":"https://api.github.com/users/guumaster/gists{/gist_id}","starred_url":"https://api.github.com/users/guumaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guumaster/subscriptions","organizations_url":"https://api.github.com/users/guumaster/orgs","repos_url":"https://api.github.com/users/guumaster/repos","events_url":"https://api.github.com/users/guumaster/events{/privacy}","received_events_url":"https://api.github.com/users/guumaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-26T20:41:49Z","updated_at":"2018-06-27T07:19:20Z","closed_at":null,"author_association":"NONE","body":"Is possible to have a scoped logger in a submodule used in the controller?\r\n\r\n`controller(scoped)` => `moduleA` => `moduleB`. \r\n\r\nI want to use a `logger` on moduleB scoped to the request (with traceId, correlation, etc). Is it possible?  Thanks\r\n"},"comment":{"url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/comments/400568744","html_url":"https://github.com/talyssonoc/awilix-express/issues/13#issuecomment-400568744","issue_url":"https://api.github.com/repos/talyssonoc/awilix-express/issues/13","id":400568744,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDU2ODc0NA==","user":{"login":"jeffijoe","id":2505474,"node_id":"MDQ6VXNlcjI1MDU0NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/2505474?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffijoe","html_url":"https://github.com/jeffijoe","followers_url":"https://api.github.com/users/jeffijoe/followers","following_url":"https://api.github.com/users/jeffijoe/following{/other_user}","gists_url":"https://api.github.com/users/jeffijoe/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffijoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffijoe/subscriptions","organizations_url":"https://api.github.com/users/jeffijoe/orgs","repos_url":"https://api.github.com/users/jeffijoe/repos","events_url":"https://api.github.com/users/jeffijoe/events{/privacy}","received_events_url":"https://api.github.com/users/jeffijoe/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T07:19:20Z","updated_at":"2018-06-27T07:19:20Z","author_association":"NONE","body":"Here's an example. Include this before your controllers get resolved, and any module that gets resolved in that scope will receive that logger.\r\n\r\n```js\r\napp.use((req, res) => {\r\n  const logger = {\r\n    log: (message) => {\r\n      console.log(`${req.method} ${req.path}: ${message}`)\r\n    }\r\n  }\r\n\r\n  req.container.register({\r\n    logger: asValue(logger)\r\n  })\r\n})\r\n```"}}
{"actor":{"display_login":"jeffijoe"}}