GitHub PullRequestReviewCommentEvent at 2014-09-23 22:14:19
Repository: pushgo
Actor: jrconlin
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/comments/17943143","id":17943143,"diff_hunk":"@@ -5,30 +5,76 @@\n package simplepush\n \n import (\n+\t\"bufio\"\n+\t\"bytes\"\n+\t\"encoding/json\"\n \t\"fmt\"\n+\t\"io\"\n \t\"log\"\n+\t\"net\"\n+\t\"net/http\"\n \t\"os\"\n-\t\"runtime\"\n \t\"strconv\"\n \t\"strings\"\n+\t\"time\"\n+\n+\t\"code.google.com/p/goprotobuf/proto\"\n+\t\"github.com/mozilla-services/heka/message\"\n+\t\"github.com/mozilla-services/pushgo/id\"\n+)\n+\n+// A HekaFormat specifies the Heka log message format. The binary Protobuf\n+// format is more efficient, and should be preferred over the JSON encoding\n+// when human readability is not a concern.\n+type HekaFormat int\n+\n+// Heka message formats.\n+const (\n+\tHekaProtobuf HekaFormat = iota\n+\tHekaJSON\n )\n \n-// Log levels\n+// A LogLevel represents a message log level.\n type LogLevel int32\n \n+// syslog severity levels.\n const (\n-\tCRITICAL LogLevel = iota\n+\tEMERGENCY LogLevel = iota\n+\tALERT\n+\tCRITICAL","path":"src/github.com/mozilla-services/pushgo/simplepush/log.go","position":43,"original_position":43,"commit_id":"3b075b590887124f0bfbf14dfa716179ca3272ba","original_commit_id":"3b075b590887124f0bfbf14dfa716179ca3272ba","user":{"login":"jrconlin","id":35755,"avatar_url":"https://avatars.githubusercontent.com/u/35755?v=2","gravatar_id":"","url":"https://api.github.com/users/jrconlin","html_url":"https://github.com/jrconlin","followers_url":"https://api.github.com/users/jrconlin/followers","following_url":"https://api.github.com/users/jrconlin/following{/other_user}","gists_url":"https://api.github.com/users/jrconlin/gists{/gist_id}","starred_url":"https://api.github.com/users/jrconlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrconlin/subscriptions","organizations_url":"https://api.github.com/users/jrconlin/orgs","repos_url":"https://api.github.com/users/jrconlin/repos","events_url":"https://api.github.com/users/jrconlin/events{/privacy}","received_events_url":"https://api.github.com/users/jrconlin/received_events","type":"User","site_admin":false},"body":"These are defined as the SYSLOG severity levels: http://en.wikipedia.org/wiki/Syslog#Severity_levels and have been identified as how Cloud Services should identify log messages https://mana.mozilla.org/wiki/display/CLOUDSERVICES/Logging+Standard \r\n\r\n","created_at":"2014-09-23T22:14:19Z","updated_at":"2014-09-23T22:14:19Z","html_url":"https://github.com/mozilla-services/pushgo/pull/86#discussion_r17943143","pull_request_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/comments/17943143"},"html":{"href":"https://github.com/mozilla-services/pushgo/pull/86#discussion_r17943143"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86","id":21277255,"html_url":"https://github.com/mozilla-services/pushgo/pull/86","diff_url":"https://github.com/mozilla-services/pushgo/pull/86.diff","patch_url":"https://github.com/mozilla-services/pushgo/pull/86.patch","issue_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/86","number":86,"state":"open","locked":false,"title":"Refactor logging","user":{"login":"kitcambridge","id":243830,"avatar_url":"https://avatars.githubusercontent.com/u/243830?v=2","gravatar_id":"","url":"https://api.github.com/users/kitcambridge","html_url":"https://github.com/kitcambridge","followers_url":"https://api.github.com/users/kitcambridge/followers","following_url":"https://api.github.com/users/kitcambridge/following{/other_user}","gists_url":"https://api.github.com/users/kitcambridge/gists{/gist_id}","starred_url":"https://api.github.com/users/kitcambridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitcambridge/subscriptions","organizations_url":"https://api.github.com/users/kitcambridge/orgs","repos_url":"https://api.github.com/users/kitcambridge/repos","events_url":"https://api.github.com/users/kitcambridge/events{/privacy}","received_events_url":"https://api.github.com/users/kitcambridge/received_events","type":"User","site_admin":false},"body":"This pull request adds logging for all incoming requests, clarifies existing log levels, and adds a `HekaLogger` implementation for compatibility with the Cloud Services [logging standard](https://mana.mozilla.org/wiki/display/CLOUDSERVICES/Logging+Standard).\r\n\r\n* HekaLogger` logs Protocol Buffer (`HekaProtobuf`) or JSON (`HekaJSON`)-encoded log messages to standard output.\r\n* `TextLogger` replaces `StdOutLogger` for logging output using @jrconlin's human-readable format (see jrconlin/FindMyDevice@65c0f33684e4d01a9e70d02d497d17668aa2fe3b).\r\n* All incoming requests and `Worker`s are tagged with the `X-Request-Id` header. This is a convention used by [Heroku](https://devcenter.heroku.com/articles/http-request-id), [restify](http://mcavage.me/node-restify/), etc., and allows correlating log lines for the same request. This value is sent in the `t` log field.\r\n* `LogHandler` wraps `http.Handler`s and logs request replies. `logResponseWriter` wraps `http.ResponseWriter`s to record response summaries.\r\n* Add an `ErrorCode` type and application error codes. These are not currently logged or forwarded to the client, though I think it would be nice to do both soon.\r\n* Logger calls that may incur overhead (such as function calls) are now wrapped in `Logger.ShouldLog()` checks. This check is omitted if the log fields contain simple string values, since `Logger.Log()` calls `Logger.ShouldLog()` internally.\r\n* Remove the last few `log.Printf()` and `debug.PrintStack()` calls.\r\n* `Logger.Log()` and all `SimpleLogger` convenience methods now return errors, and use syslog severity levels for compatibility with the Heka message format.","created_at":"2014-09-16T05:31:40Z","updated_at":"2014-09-23T22:14:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30201e056100c82093d017f08ca340f7c8ff51c3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/86/comments","statuses_url":"https://api.github.com/repos/mozilla-services/pushgo/statuses/3b075b590887124f0bfbf14dfa716179ca3272ba","head":{"label":"mozilla-services:feature/logging","ref":"feature/logging","sha":"3b075b590887124f0bfbf14dfa716179ca3272ba","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":11289838,"name":"pushgo","full_name":"mozilla-services/pushgo","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/pushgo","description":"Go based SimplePush server","fork":true,"url":"https://api.github.com/repos/mozilla-services/pushgo","forks_url":"https://api.github.com/repos/mozilla-services/pushgo/forks","keys_url":"https://api.github.com/repos/mozilla-services/pushgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/pushgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/pushgo/teams","hooks_url":"https://api.github.com/repos/mozilla-services/pushgo/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/pushgo/events","assignees_url":"https://api.github.com/repos/mozilla-services/pushgo/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/pushgo/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/pushgo/tags","blobs_url":"https://api.github.com/repos/mozilla-services/pushgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/pushgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/pushgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/pushgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/pushgo/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/pushgo/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/pushgo/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/pushgo/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/pushgo/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/pushgo/subscription","commits_url":"https://api.github.com/repos/mozilla-services/pushgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/pushgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/pushgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/pushgo/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/pushgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/pushgo/merges","archive_url":"https://api.github.com/repos/mozilla-services/pushgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/pushgo/downloads","issues_url":"https://api.github.com/repos/mozilla-services/pushgo/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/pushgo/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/pushgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/pushgo/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/pushgo/releases{/id}","created_at":"2013-07-09T18:06:52Z","updated_at":"2014-09-02T01:25:50Z","pushed_at":"2014-09-23T20:38:44Z","git_url":"git://github.com/mozilla-services/pushgo.git","ssh_url":"git@github.com:mozilla-services/pushgo.git","clone_url":"https://github.com/mozilla-services/pushgo.git","svn_url":"https://github.com/mozilla-services/pushgo","homepage":null,"size":2657,"stargazers_count":12,"watchers_count":12,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":12,"default_branch":"dev"}},"base":{"label":"mozilla-services:dev","ref":"dev","sha":"0a664d1db5e0fb1d2ef56b0e3f093ae23a02f4fd","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":11289838,"name":"pushgo","full_name":"mozilla-services/pushgo","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=2","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/pushgo","description":"Go based SimplePush server","fork":true,"url":"https://api.github.com/repos/mozilla-services/pushgo","forks_url":"https://api.github.com/repos/mozilla-services/pushgo/forks","keys_url":"https://api.github.com/repos/mozilla-services/pushgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/pushgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/pushgo/teams","hooks_url":"https://api.github.com/repos/mozilla-services/pushgo/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/pushgo/events","assignees_url":"https://api.github.com/repos/mozilla-services/pushgo/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/pushgo/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/pushgo/tags","blobs_url":"https://api.github.com/repos/mozilla-services/pushgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/pushgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/pushgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/pushgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/pushgo/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/pushgo/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/pushgo/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/pushgo/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/pushgo/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/pushgo/subscription","commits_url":"https://api.github.com/repos/mozilla-services/pushgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/pushgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/pushgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/pushgo/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/pushgo/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/pushgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/pushgo/merges","archive_url":"https://api.github.com/repos/mozilla-services/pushgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/pushgo/downloads","issues_url":"https://api.github.com/repos/mozilla-services/pushgo/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/pushgo/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/pushgo/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/pushgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/pushgo/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/pushgo/releases{/id}","created_at":"2013-07-09T18:06:52Z","updated_at":"2014-09-02T01:25:50Z","pushed_at":"2014-09-23T20:38:44Z","git_url":"git://github.com/mozilla-services/pushgo.git","ssh_url":"git@github.com:mozilla-services/pushgo.git","clone_url":"https://github.com/mozilla-services/pushgo.git","svn_url":"https://github.com/mozilla-services/pushgo","homepage":null,"size":2657,"stargazers_count":12,"watchers_count":12,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":12,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86"},"html":{"href":"https://github.com/mozilla-services/pushgo/pull/86"},"issue":{"href":"https://api.github.com/repos/mozilla-services/pushgo/issues/86"},"comments":{"href":"https://api.github.com/repos/mozilla-services/pushgo/issues/86/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/pushgo/pulls/86/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/pushgo/statuses/3b075b590887124f0bfbf14dfa716179ca3272ba"}}}}