{"action":"created","comment":{"url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/comments/217871008","pull_request_review_id":155698004,"id":217871008,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzg3MTAwOA==","diff_hunk":"@@ -21,10 +25,44 @@ type HTTP struct {\n // Serve runs an HTTP server on the specified local address. This serves\n // connections forever, and probably wants to be run in a goroutine. Panics on\n // any error in the initial setup or in accepting connections.\n-func (h *HTTP) Serve() {\n+func (h *HTTP) Serve(logRequests bool, logFormat string, logger *logrus.Logger) {\n \tr := mux.NewRouter()\n \tr.PathPrefix(\"/\").Subrouter()\n \trestserver.PopulateRouter(r, h.coord)\n \tr.Handle(\"/metrics\", promhttp.Handler())\n-\thttp.ListenAndServe(h.laddr, r)\n+\n+\tn := negroni.New()\n+\tn.Use(negroni.NewRecovery())\n+\n+\t// Wrap the root handler in a logger if desired.\n+\tvar handler http.Handler = r\n+\tif logRequests {\n+\t\thandler = logWrapper(logFormat, logger, handler)\n+\t}\n+\tn.UseHandler(handler)\n+\n+\thttp.ListenAndServe(h.laddr, n)\n+}\n+\n+// logWrapper creates a wrapping logger for the given handler. It is setup this\n+// way rather than conforming to the negroni paradigm because the API fo the\n+// requestlog package, which this uses, is not directly compatible.\n+func logWrapper(logFormat string, logger *logrus.Logger, inner http.Handler) http.Handler {\n+\tvar reqLog requestlog.Logger\n+\tswitch logFormat {\n+\tcase \"ncsa\":","path":"cmd/coordinated/http.go","position":47,"original_position":47,"commit_id":"faf501f0b8d6aa9acb1712006986cb4c1863ed8d","original_commit_id":"faf501f0b8d6aa9acb1712006986cb4c1863ed8d","user":{"login":"henrywallace","id":2768233,"node_id":"MDQ6VXNlcjI3NjgyMzM=","avatar_url":"https://avatars3.githubusercontent.com/u/2768233?v=4","gravatar_id":"","url":"https://api.github.com/users/henrywallace","html_url":"https://github.com/henrywallace","followers_url":"https://api.github.com/users/henrywallace/followers","following_url":"https://api.github.com/users/henrywallace/following{/other_user}","gists_url":"https://api.github.com/users/henrywallace/gists{/gist_id}","starred_url":"https://api.github.com/users/henrywallace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrywallace/subscriptions","organizations_url":"https://api.github.com/users/henrywallace/orgs","repos_url":"https://api.github.com/users/henrywallace/repos","events_url":"https://api.github.com/users/henrywallace/events{/privacy}","received_events_url":"https://api.github.com/users/henrywallace/received_events","type":"User","site_admin":false},"body":"With a presidence I'm happy the way things are here :)","created_at":"2018-09-15T01:06:06Z","updated_at":"2018-09-15T01:06:06Z","html_url":"https://github.com/diffeo/go-coordinate/pull/22#discussion_r217871008","pull_request_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/comments/217871008"},"html":{"href":"https://github.com/diffeo/go-coordinate/pull/22#discussion_r217871008"},"pull_request":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22"}},"in_reply_to_id":217870476},"pull_request":{"url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22","id":215739421,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NzM5NDIx","html_url":"https://github.com/diffeo/go-coordinate/pull/22","diff_url":"https://github.com/diffeo/go-coordinate/pull/22.diff","patch_url":"https://github.com/diffeo/go-coordinate/pull/22.patch","issue_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/22","number":22,"state":"open","locked":false,"title":"Add HTTP request logging middleware","user":{"login":"kujenga","id":4854867,"node_id":"MDQ6VXNlcjQ4NTQ4Njc=","avatar_url":"https://avatars2.githubusercontent.com/u/4854867?v=4","gravatar_id":"","url":"https://api.github.com/users/kujenga","html_url":"https://github.com/kujenga","followers_url":"https://api.github.com/users/kujenga/followers","following_url":"https://api.github.com/users/kujenga/following{/other_user}","gists_url":"https://api.github.com/users/kujenga/gists{/gist_id}","starred_url":"https://api.github.com/users/kujenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kujenga/subscriptions","organizations_url":"https://api.github.com/users/kujenga/orgs","repos_url":"https://api.github.com/users/kujenga/repos","events_url":"https://api.github.com/users/kujenga/events{/privacy}","received_events_url":"https://api.github.com/users/kujenga/received_events","type":"User","site_admin":false},"body":"This commit updates the HTTP endpoints with the same level of introspectability that the CBOR RPC server functionality provides. I've introduced two new packages as part of this, negroni, and the [new](https://blog.golang.org/go-cloud) go-cloud/requestlog package. Negroni didn't end up being used for the logger, as it is incompatible with the way the logger is intended to be used, but the recovery middleware seemed like a good idea to have anyhow.","created_at":"2018-09-15T00:40:38Z","updated_at":"2018-09-15T01:06:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56c849fcc95df52aa29b4f01453c7eb715058ad3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"JohnEmhoff","id":1692535,"node_id":"MDQ6VXNlcjE2OTI1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1692535?v=4","gravatar_id":"","url":"https://api.github.com/users/JohnEmhoff","html_url":"https://github.com/JohnEmhoff","followers_url":"https://api.github.com/users/JohnEmhoff/followers","following_url":"https://api.github.com/users/JohnEmhoff/following{/other_user}","gists_url":"https://api.github.com/users/JohnEmhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnEmhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnEmhoff/subscriptions","organizations_url":"https://api.github.com/users/JohnEmhoff/orgs","repos_url":"https://api.github.com/users/JohnEmhoff/repos","events_url":"https://api.github.com/users/JohnEmhoff/events{/privacy}","received_events_url":"https://api.github.com/users/JohnEmhoff/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22/commits","review_comments_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22/comments","review_comment_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/22/comments","statuses_url":"https://api.github.com/repos/diffeo/go-coordinate/statuses/faf501f0b8d6aa9acb1712006986cb4c1863ed8d","head":{"label":"diffeo:at/http-request-logging","ref":"at/http-request-logging","sha":"faf501f0b8d6aa9acb1712006986cb4c1863ed8d","user":{"login":"diffeo","id":1677003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzcwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1677003?v=4","gravatar_id":"","url":"https://api.github.com/users/diffeo","html_url":"https://github.com/diffeo","followers_url":"https://api.github.com/users/diffeo/followers","following_url":"https://api.github.com/users/diffeo/following{/other_user}","gists_url":"https://api.github.com/users/diffeo/gists{/gist_id}","starred_url":"https://api.github.com/users/diffeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diffeo/subscriptions","organizations_url":"https://api.github.com/users/diffeo/orgs","repos_url":"https://api.github.com/users/diffeo/repos","events_url":"https://api.github.com/users/diffeo/events{/privacy}","received_events_url":"https://api.github.com/users/diffeo/received_events","type":"Organization","site_admin":false},"repo":{"id":46144321,"node_id":"MDEwOlJlcG9zaXRvcnk0NjE0NDMyMQ==","name":"go-coordinate","full_name":"diffeo/go-coordinate","owner":{"login":"diffeo","id":1677003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzcwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1677003?v=4","gravatar_id":"","url":"https://api.github.com/users/diffeo","html_url":"https://github.com/diffeo","followers_url":"https://api.github.com/users/diffeo/followers","following_url":"https://api.github.com/users/diffeo/following{/other_user}","gists_url":"https://api.github.com/users/diffeo/gists{/gist_id}","starred_url":"https://api.github.com/users/diffeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diffeo/subscriptions","organizations_url":"https://api.github.com/users/diffeo/orgs","repos_url":"https://api.github.com/users/diffeo/repos","events_url":"https://api.github.com/users/diffeo/events{/privacy}","received_events_url":"https://api.github.com/users/diffeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diffeo/go-coordinate","description":"Coordinate job queue system, Go implementation","fork":false,"url":"https://api.github.com/repos/diffeo/go-coordinate","forks_url":"https://api.github.com/repos/diffeo/go-coordinate/forks","keys_url":"https://api.github.com/repos/diffeo/go-coordinate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diffeo/go-coordinate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diffeo/go-coordinate/teams","hooks_url":"https://api.github.com/repos/diffeo/go-coordinate/hooks","issue_events_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/events{/number}","events_url":"https://api.github.com/repos/diffeo/go-coordinate/events","assignees_url":"https://api.github.com/repos/diffeo/go-coordinate/assignees{/user}","branches_url":"https://api.github.com/repos/diffeo/go-coordinate/branches{/branch}","tags_url":"https://api.github.com/repos/diffeo/go-coordinate/tags","blobs_url":"https://api.github.com/repos/diffeo/go-coordinate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diffeo/go-coordinate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diffeo/go-coordinate/git/refs{/sha}","trees_url":"https://api.github.com/repos/diffeo/go-coordinate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diffeo/go-coordinate/statuses/{sha}","languages_url":"https://api.github.com/repos/diffeo/go-coordinate/languages","stargazers_url":"https://api.github.com/repos/diffeo/go-coordinate/stargazers","contributors_url":"https://api.github.com/repos/diffeo/go-coordinate/contributors","subscribers_url":"https://api.github.com/repos/diffeo/go-coordinate/subscribers","subscription_url":"https://api.github.com/repos/diffeo/go-coordinate/subscription","commits_url":"https://api.github.com/repos/diffeo/go-coordinate/commits{/sha}","git_commits_url":"https://api.github.com/repos/diffeo/go-coordinate/git/commits{/sha}","comments_url":"https://api.github.com/repos/diffeo/go-coordinate/comments{/number}","issue_comment_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/comments{/number}","contents_url":"https://api.github.com/repos/diffeo/go-coordinate/contents/{+path}","compare_url":"https://api.github.com/repos/diffeo/go-coordinate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diffeo/go-coordinate/merges","archive_url":"https://api.github.com/repos/diffeo/go-coordinate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diffeo/go-coordinate/downloads","issues_url":"https://api.github.com/repos/diffeo/go-coordinate/issues{/number}","pulls_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls{/number}","milestones_url":"https://api.github.com/repos/diffeo/go-coordinate/milestones{/number}","notifications_url":"https://api.github.com/repos/diffeo/go-coordinate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diffeo/go-coordinate/labels{/name}","releases_url":"https://api.github.com/repos/diffeo/go-coordinate/releases{/id}","deployments_url":"https://api.github.com/repos/diffeo/go-coordinate/deployments","created_at":"2015-11-13T20:02:35Z","updated_at":"2018-09-07T20:28:26Z","pushed_at":"2018-09-15T00:40:39Z","git_url":"git://github.com/diffeo/go-coordinate.git","ssh_url":"git@github.com:diffeo/go-coordinate.git","clone_url":"https://github.com/diffeo/go-coordinate.git","svn_url":"https://github.com/diffeo/go-coordinate","homepage":null,"size":529,"stargazers_count":21,"watchers_count":21,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":21,"default_branch":"master"}},"base":{"label":"diffeo:master","ref":"master","sha":"7a26dd0204ce40ec6345b47155fab18344f226a0","user":{"login":"diffeo","id":1677003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzcwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1677003?v=4","gravatar_id":"","url":"https://api.github.com/users/diffeo","html_url":"https://github.com/diffeo","followers_url":"https://api.github.com/users/diffeo/followers","following_url":"https://api.github.com/users/diffeo/following{/other_user}","gists_url":"https://api.github.com/users/diffeo/gists{/gist_id}","starred_url":"https://api.github.com/users/diffeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diffeo/subscriptions","organizations_url":"https://api.github.com/users/diffeo/orgs","repos_url":"https://api.github.com/users/diffeo/repos","events_url":"https://api.github.com/users/diffeo/events{/privacy}","received_events_url":"https://api.github.com/users/diffeo/received_events","type":"Organization","site_admin":false},"repo":{"id":46144321,"node_id":"MDEwOlJlcG9zaXRvcnk0NjE0NDMyMQ==","name":"go-coordinate","full_name":"diffeo/go-coordinate","owner":{"login":"diffeo","id":1677003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NzcwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1677003?v=4","gravatar_id":"","url":"https://api.github.com/users/diffeo","html_url":"https://github.com/diffeo","followers_url":"https://api.github.com/users/diffeo/followers","following_url":"https://api.github.com/users/diffeo/following{/other_user}","gists_url":"https://api.github.com/users/diffeo/gists{/gist_id}","starred_url":"https://api.github.com/users/diffeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diffeo/subscriptions","organizations_url":"https://api.github.com/users/diffeo/orgs","repos_url":"https://api.github.com/users/diffeo/repos","events_url":"https://api.github.com/users/diffeo/events{/privacy}","received_events_url":"https://api.github.com/users/diffeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diffeo/go-coordinate","description":"Coordinate job queue system, Go implementation","fork":false,"url":"https://api.github.com/repos/diffeo/go-coordinate","forks_url":"https://api.github.com/repos/diffeo/go-coordinate/forks","keys_url":"https://api.github.com/repos/diffeo/go-coordinate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diffeo/go-coordinate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diffeo/go-coordinate/teams","hooks_url":"https://api.github.com/repos/diffeo/go-coordinate/hooks","issue_events_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/events{/number}","events_url":"https://api.github.com/repos/diffeo/go-coordinate/events","assignees_url":"https://api.github.com/repos/diffeo/go-coordinate/assignees{/user}","branches_url":"https://api.github.com/repos/diffeo/go-coordinate/branches{/branch}","tags_url":"https://api.github.com/repos/diffeo/go-coordinate/tags","blobs_url":"https://api.github.com/repos/diffeo/go-coordinate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diffeo/go-coordinate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diffeo/go-coordinate/git/refs{/sha}","trees_url":"https://api.github.com/repos/diffeo/go-coordinate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diffeo/go-coordinate/statuses/{sha}","languages_url":"https://api.github.com/repos/diffeo/go-coordinate/languages","stargazers_url":"https://api.github.com/repos/diffeo/go-coordinate/stargazers","contributors_url":"https://api.github.com/repos/diffeo/go-coordinate/contributors","subscribers_url":"https://api.github.com/repos/diffeo/go-coordinate/subscribers","subscription_url":"https://api.github.com/repos/diffeo/go-coordinate/subscription","commits_url":"https://api.github.com/repos/diffeo/go-coordinate/commits{/sha}","git_commits_url":"https://api.github.com/repos/diffeo/go-coordinate/git/commits{/sha}","comments_url":"https://api.github.com/repos/diffeo/go-coordinate/comments{/number}","issue_comment_url":"https://api.github.com/repos/diffeo/go-coordinate/issues/comments{/number}","contents_url":"https://api.github.com/repos/diffeo/go-coordinate/contents/{+path}","compare_url":"https://api.github.com/repos/diffeo/go-coordinate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diffeo/go-coordinate/merges","archive_url":"https://api.github.com/repos/diffeo/go-coordinate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diffeo/go-coordinate/downloads","issues_url":"https://api.github.com/repos/diffeo/go-coordinate/issues{/number}","pulls_url":"https://api.github.com/repos/diffeo/go-coordinate/pulls{/number}","milestones_url":"https://api.github.com/repos/diffeo/go-coordinate/milestones{/number}","notifications_url":"https://api.github.com/repos/diffeo/go-coordinate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diffeo/go-coordinate/labels{/name}","releases_url":"https://api.github.com/repos/diffeo/go-coordinate/releases{/id}","deployments_url":"https://api.github.com/repos/diffeo/go-coordinate/deployments","created_at":"2015-11-13T20:02:35Z","updated_at":"2018-09-07T20:28:26Z","pushed_at":"2018-09-15T00:40:39Z","git_url":"git://github.com/diffeo/go-coordinate.git","ssh_url":"git@github.com:diffeo/go-coordinate.git","clone_url":"https://github.com/diffeo/go-coordinate.git","svn_url":"https://github.com/diffeo/go-coordinate","homepage":null,"size":529,"stargazers_count":21,"watchers_count":21,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22"},"html":{"href":"https://github.com/diffeo/go-coordinate/pull/22"},"issue":{"href":"https://api.github.com/repos/diffeo/go-coordinate/issues/22"},"comments":{"href":"https://api.github.com/repos/diffeo/go-coordinate/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/diffeo/go-coordinate/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/diffeo/go-coordinate/statuses/faf501f0b8d6aa9acb1712006986cb4c1863ed8d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"henrywallace"}}