{"action":"created","comment":{"url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/comments/94591823","pull_request_review_id":15119286,"id":94591823,"diff_hunk":"@@ -7,27 +7,33 @@ let\n   WebSocketServer = require('ws').Server,\n   Backend = require('./Backend'),\n   async = require('async'),\n+  RequestContext = require('kuzzle-common-objects').models.RequestContext,\n   ServiceUnavailableError = require('kuzzle-common-objects').errors.ServiceUnavailableError;\n \n+let","path":"lib/service/Broker.js","position":7,"original_position":7,"commit_id":"cdda5f1dba9e60b688e6a1a45a663074ead01b96","original_commit_id":"cdda5f1dba9e60b688e6a1a45a663074ead01b96","user":{"login":"dbengsch","id":16542512,"avatar_url":"https://avatars.githubusercontent.com/u/16542512?v=3","gravatar_id":"","url":"https://api.github.com/users/dbengsch","html_url":"https://github.com/dbengsch","followers_url":"https://api.github.com/users/dbengsch/followers","following_url":"https://api.github.com/users/dbengsch/following{/other_user}","gists_url":"https://api.github.com/users/dbengsch/gists{/gist_id}","starred_url":"https://api.github.com/users/dbengsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbengsch/subscriptions","organizations_url":"https://api.github.com/users/dbengsch/orgs","repos_url":"https://api.github.com/users/dbengsch/repos","events_url":"https://api.github.com/users/dbengsch/events{/privacy}","received_events_url":"https://api.github.com/users/dbengsch/received_events","type":"User","site_admin":false},"body":"why is it separated from the other declarations ?","created_at":"2017-01-04T14:29:34Z","updated_at":"2017-01-04T14:33:29Z","html_url":"https://github.com/kuzzleio/kuzzle-proxy/pull/44#discussion_r94591823","pull_request_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/comments/94591823"},"html":{"href":"https://github.com/kuzzleio/kuzzle-proxy/pull/44#discussion_r94591823"},"pull_request":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44","id":98566045,"html_url":"https://github.com/kuzzleio/kuzzle-proxy/pull/44","diff_url":"https://github.com/kuzzleio/kuzzle-proxy/pull/44.diff","patch_url":"https://github.com/kuzzleio/kuzzle-proxy/pull/44.patch","issue_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/44","number":44,"state":"open","locked":false,"title":"Access logs","user":{"login":"benoitvidis","id":6680551,"avatar_url":"https://avatars.githubusercontent.com/u/6680551?v=3","gravatar_id":"","url":"https://api.github.com/users/benoitvidis","html_url":"https://github.com/benoitvidis","followers_url":"https://api.github.com/users/benoitvidis/followers","following_url":"https://api.github.com/users/benoitvidis/following{/other_user}","gists_url":"https://api.github.com/users/benoitvidis/gists{/gist_id}","starred_url":"https://api.github.com/users/benoitvidis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoitvidis/subscriptions","organizations_url":"https://api.github.com/users/benoitvidis/orgs","repos_url":"https://api.github.com/users/benoitvidis/repos","events_url":"https://api.github.com/users/benoitvidis/events{/privacy}","received_events_url":"https://api.github.com/users/benoitvidis/received_events","type":"User","site_admin":false},"body":"cf #39 \r\n\r\n# Loggers\r\n\r\n* 2 loggers ([winston](https://github.com/winstonjs/winston)) are injected in the Proxy, each having its own configuration:\r\n  1. One dedicated to access logs\r\n  2. One dedicated to other (errors) logs\r\n* All `console.log` and `console.error` calls are removed and use the error logger instead.\r\n* Default configuration is to output logs to the terminal. Access logs are sent to stdout, ~~error logs are sent to stderr.~~ [EDIT: error logs levels `warn`, `error` and `debug` are sent to stderr, other levels are output to stdout.]\r\n* Currently supported transports are `console`, `file`, `elasticsearch` and `syslog`.\r\n\r\n## Access logs output format\r\n\r\nFor the time being, 2 output formats are supported: `logstash` and `combined`. \r\nThe `logstash` format outputs the data in json, ready to use by logstash (or by elasticsearch transport).\r\nThe `combined` format mimics [Apache combined](http://httpd.apache.org/docs/current/logs.html#combined) format.\r\n\r\nMain differences are:\r\n\r\n* The user data is taken from the jwt token when available with a fall back to Basic auth\r\n* For non-http protocols, the URL is rebuilt based on the request data: `/controller/action/index/collection/_id?additional-param=1&additional-param=2`. The verb for such cases is always set to `DO` and the protocol is the one take from the connection, uppercased (i.e., `WEBSOCKET` or `MQTT`.\r\n\r\n## unrelated / boyscooting\r\n\r\nWhile not directly linked to this PR, the context object passed to the protocol plugins is cleaned up to its strict minimal form.\r\nThis object was previously used to store the global scope of the proxy application. Loggers had to be included in this scope but there was no reason the protocol plugins could access the access log, thus this little refactor.\r\n\r\nAll the components of the proxy that previously relied on the context now use a complete proxy instance.\r\n\r\n\r\n@dependencies / @todo\r\n* https://github.com/kuzzleio/kuzzle-common-objects/pull/14\r\n* https://github.com/kuzzleio/kuzzle/pull/595\r\n* https://github.com/kuzzleio/kuzzle-plugin-websocket/pull/12\r\n* https://github.com/kuzzleio/kuzzle-plugin-socketio/pull/14\r\n* https://github.com/kuzzleio/kuzzle-plugin-mqtt/pull/8\r\n* https://github.com/kuzzleio/kuzzle-load-balancer","created_at":"2016-12-19T13:35:56Z","updated_at":"2017-01-04T14:33:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3309a0b599d4ecc3765b8ba3f78907db5f68f388","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44/commits","review_comments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44/comments","review_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/44/comments","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/statuses/cdda5f1dba9e60b688e6a1a45a663074ead01b96","head":{"label":"kuzzleio:develop-39-access-logs","ref":"develop-39-access-logs","sha":"cdda5f1dba9e60b688e6a1a45a663074ead01b96","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":58195368,"name":"kuzzle-proxy","full_name":"kuzzleio/kuzzle-proxy","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle-proxy","description":"Node.js proxy for Kuzzle","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/deployments","created_at":"2016-05-06T09:12:00Z","updated_at":"2016-12-20T12:59:13Z","pushed_at":"2017-01-04T09:31:55Z","git_url":"git://github.com/kuzzleio/kuzzle-proxy.git","ssh_url":"git@github.com:kuzzleio/kuzzle-proxy.git","clone_url":"https://github.com/kuzzleio/kuzzle-proxy.git","svn_url":"https://github.com/kuzzleio/kuzzle-proxy","homepage":"","size":286,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"kuzzleio:develop","ref":"develop","sha":"af6cb923f9bf776b57c36d80e5b22f1fb645cafe","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":58195368,"name":"kuzzle-proxy","full_name":"kuzzleio/kuzzle-proxy","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle-proxy","description":"Node.js proxy for Kuzzle","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/deployments","created_at":"2016-05-06T09:12:00Z","updated_at":"2016-12-20T12:59:13Z","pushed_at":"2017-01-04T09:31:55Z","git_url":"git://github.com/kuzzleio/kuzzle-proxy.git","ssh_url":"git@github.com:kuzzleio/kuzzle-proxy.git","clone_url":"https://github.com/kuzzleio/kuzzle-proxy.git","svn_url":"https://github.com/kuzzleio/kuzzle-proxy","homepage":"","size":286,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44"},"html":{"href":"https://github.com/kuzzleio/kuzzle-proxy/pull/44"},"issue":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/44"},"comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/kuzzleio/kuzzle-proxy/statuses/cdda5f1dba9e60b688e6a1a45a663074ead01b96"}}}}
{"actor":{"display_login":"dbengsch"}}