{"action":"created","issue":{"url":"https://api.github.com/repos/remind101/pkg/issues/9","labels_url":"https://api.github.com/repos/remind101/pkg/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/remind101/pkg/issues/9/comments","events_url":"https://api.github.com/repos/remind101/pkg/issues/9/events","html_url":"https://github.com/remind101/pkg/pull/9","id":71360775,"number":9,"title":"Package trace.","user":{"login":"ejholmes","id":95166,"avatar_url":"https://avatars.githubusercontent.com/u/95166?v=3","gravatar_id":"","url":"https://api.github.com/users/ejholmes","html_url":"https://github.com/ejholmes","followers_url":"https://api.github.com/users/ejholmes/followers","following_url":"https://api.github.com/users/ejholmes/following{/other_user}","gists_url":"https://api.github.com/users/ejholmes/gists{/gist_id}","starred_url":"https://api.github.com/users/ejholmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejholmes/subscriptions","organizations_url":"https://api.github.com/users/ejholmes/orgs","repos_url":"https://api.github.com/users/ejholmes/repos","events_url":"https://api.github.com/users/ejholmes/events{/privacy}","received_events_url":"https://api.github.com/users/ejholmes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-27T18:14:28Z","updated_at":"2015-05-18T16:43:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/remind101/pkg/pulls/9","html_url":"https://github.com/remind101/pkg/pull/9","diff_url":"https://github.com/remind101/pkg/pull/9.diff","patch_url":"https://github.com/remind101/pkg/pull/9.patch"},"body":"Not necessarily going to merge this, just opening it up for discussion. Package trace composes package logger and package reporter as one. It's meant to be used like a logger but the third argument takes an `error`. If the `error` is non nil, it's reported using the embedded reporter.\r\n\r\nMight be better to add a Logger implementation that checks for an `err` key in the log pairs."},"comment":{"url":"https://api.github.com/repos/remind101/pkg/issues/comments/103122500","html_url":"https://github.com/remind101/pkg/pull/9#issuecomment-103122500","issue_url":"https://api.github.com/repos/remind101/pkg/issues/9","id":103122500,"user":{"login":"ejholmes","id":95166,"avatar_url":"https://avatars.githubusercontent.com/u/95166?v=3","gravatar_id":"","url":"https://api.github.com/users/ejholmes","html_url":"https://github.com/ejholmes","followers_url":"https://api.github.com/users/ejholmes/followers","following_url":"https://api.github.com/users/ejholmes/following{/other_user}","gists_url":"https://api.github.com/users/ejholmes/gists{/gist_id}","starred_url":"https://api.github.com/users/ejholmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejholmes/subscriptions","organizations_url":"https://api.github.com/users/ejholmes/orgs","repos_url":"https://api.github.com/users/ejholmes/repos","events_url":"https://api.github.com/users/ejholmes/events{/privacy}","received_events_url":"https://api.github.com/users/ejholmes/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T16:43:28Z","updated_at":"2015-05-18T16:43:28Z","body":"Ok, still a WIP but I think what I have in here now is going in the right direction. I pulled in some concepts from docker/distribution so that we inject the http.Request into the context, and the logger can now optionally implement an interface for creating a child logger, this allows the trace package to be used like this:\r\n\r\n```go\r\nctx, done := trace.Trace(ctx)\r\ndefer func() { done(err, \"did something\", \"thing\", thing) }\r\n```\r\n\r\nThis will log a log line to the embedded logger with the function it was called from, file, line number, error, the duration of the function call and also the trace id of the parent function if present.\r\n\r\n```\r\nt=2015-05-18T16:41:47+0000 lvl=info msg=\"submitting app\" request_id=48bedb25-d06a-4898-9a39-b25fb726bd37 trace.id=eada9ebc-be5e-4b57-aee9-204447c837d6 trace.func=github.com/remind101/empire/empire/pkg/service.(*LoggedManager).Submit trace.file=/go/src/github.com/remind101/empire/empire/pkg/service/logger.go trace.line=25 trace.duration=4.06958837s app=92289c36-8644-4900-8850-7ec3578ec368\r\n```\r\n\r\nThinking I'll pull this branch into empire and tweak and polish things before merging.\r\n\r\n/cc @sanjayprabhu"}}