{"action":"created","comment":{"url":"https://api.github.com/repos/Clever/kayvee-go/pulls/comments/81011017","pull_request_review_id":2023568,"id":81011017,"diff_hunk":"@@ -81,20 +82,21 @@ func (l *logHandler) applyHandlers(req *http.Request, finalizer map[string]inter\n \treturn result\n }\n \n-// New takes in an http Handler to wrap with logging, the logger to use, and any amount of\n+// New takes in an http Handler to wrap with logging, the logger source name to use, and any amount of\n // optional handlers to customize the data that's logged.\n-func New(h http.Handler, logger *logger.Logger, handlers ...func(*http.Request) map[string]interface{}) http.Handler {\n+// On every request, the middleware will create a logger and place it in req.Context().\n+func New(h http.Handler, source string, handlers ...func(*http.Request) map[string]interface{}) http.Handler {","path":"middleware/middleware.go","position":41,"original_position":41,"commit_id":"2f81202d0b9cc2a8bf6cdb723fcb2b9304b24d93","original_commit_id":"2f81202d0b9cc2a8bf6cdb723fcb2b9304b24d93","user":{"login":"rgarcia","id":72655,"avatar_url":"https://avatars.githubusercontent.com/u/72655?v=3","gravatar_id":"","url":"https://api.github.com/users/rgarcia","html_url":"https://github.com/rgarcia","followers_url":"https://api.github.com/users/rgarcia/followers","following_url":"https://api.github.com/users/rgarcia/following{/other_user}","gists_url":"https://api.github.com/users/rgarcia/gists{/gist_id}","starred_url":"https://api.github.com/users/rgarcia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgarcia/subscriptions","organizations_url":"https://api.github.com/users/rgarcia/orgs","repos_url":"https://api.github.com/users/rgarcia/repos","events_url":"https://api.github.com/users/rgarcia/events{/privacy}","received_events_url":"https://api.github.com/users/rgarcia/received_events","type":"User","site_admin":false},"body":"It affects anyone that uses the logger we inject into req.Context() in a mutative way (SetConfig, AddContext, ...), which I think right now is just wag servers via AddContext()","created_at":"2016-09-28T20:36:02Z","updated_at":"2016-09-28T20:36:02Z","html_url":"https://github.com/Clever/kayvee-go/pull/28#discussion_r81011017","pull_request_url":"https://api.github.com/repos/Clever/kayvee-go/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/comments/81011017"},"html":{"href":"https://github.com/Clever/kayvee-go/pull/28#discussion_r81011017"},"pull_request":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/Clever/kayvee-go/pulls/28","id":87182232,"html_url":"https://github.com/Clever/kayvee-go/pull/28","diff_url":"https://github.com/Clever/kayvee-go/pull/28.diff","patch_url":"https://github.com/Clever/kayvee-go/pull/28.patch","issue_url":"https://api.github.com/repos/Clever/kayvee-go/issues/28","number":28,"state":"open","locked":false,"title":"middleware: create a logger on each request","user":{"login":"rgarcia","id":72655,"avatar_url":"https://avatars.githubusercontent.com/u/72655?v=3","gravatar_id":"","url":"https://api.github.com/users/rgarcia","html_url":"https://github.com/rgarcia","followers_url":"https://api.github.com/users/rgarcia/followers","following_url":"https://api.github.com/users/rgarcia/following{/other_user}","gists_url":"https://api.github.com/users/rgarcia/gists{/gist_id}","starred_url":"https://api.github.com/users/rgarcia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgarcia/subscriptions","organizations_url":"https://api.github.com/users/rgarcia/orgs","repos_url":"https://api.github.com/users/rgarcia/repos","events_url":"https://api.github.com/users/rgarcia/events{/privacy}","received_events_url":"https://api.github.com/users/rgarcia/received_events","type":"User","site_admin":false},"body":"The `AddContext()` method added in #26 made it possible for HTTP middleware to\r\nadd additional keys and values to the logs generated by the kayvee middleware logger. This is useful to log request-specific data generated by http handlers, e.g. error messages or unique IDs.\r\n\r\nSince kayvee middleware uses a single shared logger object across all requests, there are two problems with using `AddContext`:\r\n\r\n- `AddContext` builds up context that never goes away. E.g., if a request fails and the handler puts the error reason in the kayvee logger context, it will be logged on *all* subsequent requests.\r\n\r\n- `AddContext` writes to a map, which will panic the process when done concurrently from multiple requests.\r\n\r\nThis commit changes kayvee middleware to create a new Logger object on each request, which makes it possible for http handlers to safely call `AddContext` on this logger.","created_at":"2016-09-28T19:15:05Z","updated_at":"2016-09-28T20:36:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a2e355bd49fbfb590bded14d00fdcb9a8c5fcd5","assignee":{"login":"rgarcia","id":72655,"avatar_url":"https://avatars.githubusercontent.com/u/72655?v=3","gravatar_id":"","url":"https://api.github.com/users/rgarcia","html_url":"https://github.com/rgarcia","followers_url":"https://api.github.com/users/rgarcia/followers","following_url":"https://api.github.com/users/rgarcia/following{/other_user}","gists_url":"https://api.github.com/users/rgarcia/gists{/gist_id}","starred_url":"https://api.github.com/users/rgarcia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgarcia/subscriptions","organizations_url":"https://api.github.com/users/rgarcia/orgs","repos_url":"https://api.github.com/users/rgarcia/repos","events_url":"https://api.github.com/users/rgarcia/events{/privacy}","received_events_url":"https://api.github.com/users/rgarcia/received_events","type":"User","site_admin":false},"assignees":[{"login":"rgarcia","id":72655,"avatar_url":"https://avatars.githubusercontent.com/u/72655?v=3","gravatar_id":"","url":"https://api.github.com/users/rgarcia","html_url":"https://github.com/rgarcia","followers_url":"https://api.github.com/users/rgarcia/followers","following_url":"https://api.github.com/users/rgarcia/following{/other_user}","gists_url":"https://api.github.com/users/rgarcia/gists{/gist_id}","starred_url":"https://api.github.com/users/rgarcia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgarcia/subscriptions","organizations_url":"https://api.github.com/users/rgarcia/orgs","repos_url":"https://api.github.com/users/rgarcia/repos","events_url":"https://api.github.com/users/rgarcia/events{/privacy}","received_events_url":"https://api.github.com/users/rgarcia/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Clever/kayvee-go/pulls/28/commits","review_comments_url":"https://api.github.com/repos/Clever/kayvee-go/pulls/28/comments","review_comment_url":"https://api.github.com/repos/Clever/kayvee-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Clever/kayvee-go/issues/28/comments","statuses_url":"https://api.github.com/repos/Clever/kayvee-go/statuses/2f81202d0b9cc2a8bf6cdb723fcb2b9304b24d93","head":{"label":"Clever:fix-context","ref":"fix-context","sha":"2f81202d0b9cc2a8bf6cdb723fcb2b9304b24d93","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":24740201,"name":"kayvee-go","full_name":"Clever/kayvee-go","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/kayvee-go","description":"Logs for human and machine readability","fork":false,"url":"https://api.github.com/repos/Clever/kayvee-go","forks_url":"https://api.github.com/repos/Clever/kayvee-go/forks","keys_url":"https://api.github.com/repos/Clever/kayvee-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/kayvee-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/kayvee-go/teams","hooks_url":"https://api.github.com/repos/Clever/kayvee-go/hooks","issue_events_url":"https://api.github.com/repos/Clever/kayvee-go/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/kayvee-go/events","assignees_url":"https://api.github.com/repos/Clever/kayvee-go/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/kayvee-go/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/kayvee-go/tags","blobs_url":"https://api.github.com/repos/Clever/kayvee-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/kayvee-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/kayvee-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/kayvee-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/kayvee-go/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/kayvee-go/languages","stargazers_url":"https://api.github.com/repos/Clever/kayvee-go/stargazers","contributors_url":"https://api.github.com/repos/Clever/kayvee-go/contributors","subscribers_url":"https://api.github.com/repos/Clever/kayvee-go/subscribers","subscription_url":"https://api.github.com/repos/Clever/kayvee-go/subscription","commits_url":"https://api.github.com/repos/Clever/kayvee-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/kayvee-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/kayvee-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/kayvee-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/kayvee-go/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/kayvee-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/kayvee-go/merges","archive_url":"https://api.github.com/repos/Clever/kayvee-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/kayvee-go/downloads","issues_url":"https://api.github.com/repos/Clever/kayvee-go/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/kayvee-go/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/kayvee-go/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/kayvee-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/kayvee-go/labels{/name}","releases_url":"https://api.github.com/repos/Clever/kayvee-go/releases{/id}","deployments_url":"https://api.github.com/repos/Clever/kayvee-go/deployments","created_at":"2014-10-02T23:11:24Z","updated_at":"2016-03-04T02:38:13Z","pushed_at":"2016-09-28T19:59:17Z","git_url":"git://github.com/Clever/kayvee-go.git","ssh_url":"git@github.com:Clever/kayvee-go.git","clone_url":"https://github.com/Clever/kayvee-go.git","svn_url":"https://github.com/Clever/kayvee-go","homepage":"","size":109,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"Clever:master","ref":"master","sha":"57b5b45fa985e1f623d54f7024b7a9b290223161","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":24740201,"name":"kayvee-go","full_name":"Clever/kayvee-go","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/kayvee-go","description":"Logs for human and machine readability","fork":false,"url":"https://api.github.com/repos/Clever/kayvee-go","forks_url":"https://api.github.com/repos/Clever/kayvee-go/forks","keys_url":"https://api.github.com/repos/Clever/kayvee-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/kayvee-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/kayvee-go/teams","hooks_url":"https://api.github.com/repos/Clever/kayvee-go/hooks","issue_events_url":"https://api.github.com/repos/Clever/kayvee-go/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/kayvee-go/events","assignees_url":"https://api.github.com/repos/Clever/kayvee-go/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/kayvee-go/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/kayvee-go/tags","blobs_url":"https://api.github.com/repos/Clever/kayvee-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/kayvee-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/kayvee-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/kayvee-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/kayvee-go/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/kayvee-go/languages","stargazers_url":"https://api.github.com/repos/Clever/kayvee-go/stargazers","contributors_url":"https://api.github.com/repos/Clever/kayvee-go/contributors","subscribers_url":"https://api.github.com/repos/Clever/kayvee-go/subscribers","subscription_url":"https://api.github.com/repos/Clever/kayvee-go/subscription","commits_url":"https://api.github.com/repos/Clever/kayvee-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/kayvee-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/kayvee-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/kayvee-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/kayvee-go/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/kayvee-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/kayvee-go/merges","archive_url":"https://api.github.com/repos/Clever/kayvee-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/kayvee-go/downloads","issues_url":"https://api.github.com/repos/Clever/kayvee-go/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/kayvee-go/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/kayvee-go/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/kayvee-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/kayvee-go/labels{/name}","releases_url":"https://api.github.com/repos/Clever/kayvee-go/releases{/id}","deployments_url":"https://api.github.com/repos/Clever/kayvee-go/deployments","created_at":"2014-10-02T23:11:24Z","updated_at":"2016-03-04T02:38:13Z","pushed_at":"2016-09-28T19:59:17Z","git_url":"git://github.com/Clever/kayvee-go.git","ssh_url":"git@github.com:Clever/kayvee-go.git","clone_url":"https://github.com/Clever/kayvee-go.git","svn_url":"https://github.com/Clever/kayvee-go","homepage":"","size":109,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/28"},"html":{"href":"https://github.com/Clever/kayvee-go/pull/28"},"issue":{"href":"https://api.github.com/repos/Clever/kayvee-go/issues/28"},"comments":{"href":"https://api.github.com/repos/Clever/kayvee-go/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Clever/kayvee-go/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/Clever/kayvee-go/statuses/2f81202d0b9cc2a8bf6cdb723fcb2b9304b24d93"}}}}
{"actor":{"display_login":"rgarcia"}}