{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9169","repository_url":"https://api.github.com/repos/cockroachdb/cockroach","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9169/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9169/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9169/events","html_url":"https://github.com/cockroachdb/cockroach/pull/9169","id":175448722,"number":9169,"title":"add log in client.Batch","user":{"login":"a6802739","id":3368692,"avatar_url":"https://avatars.githubusercontent.com/u/3368692?v=3","gravatar_id":"","url":"https://api.github.com/users/a6802739","html_url":"https://github.com/a6802739","followers_url":"https://api.github.com/users/a6802739/followers","following_url":"https://api.github.com/users/a6802739/following{/other_user}","gists_url":"https://api.github.com/users/a6802739/gists{/gist_id}","starred_url":"https://api.github.com/users/a6802739/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a6802739/subscriptions","organizations_url":"https://api.github.com/users/a6802739/orgs","repos_url":"https://api.github.com/users/a6802739/repos","events_url":"https://api.github.com/users/a6802739/events{/privacy}","received_events_url":"https://api.github.com/users/a6802739/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-09-07T08:57:43Z","updated_at":"2016-09-09T11:40:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9169","html_url":"https://github.com/cockroachdb/cockroach/pull/9169","diff_url":"https://github.com/cockroachdb/cockroach/pull/9169.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/9169.patch"},"body":"@paperstreet, please look at #8324 and tell me if I done it in a right direction.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/cockroachdb/cockroach/9169)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments/245890277","html_url":"https://github.com/cockroachdb/cockroach/pull/9169#issuecomment-245890277","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9169","id":245890277,"user":{"login":"RaduBerinde","id":16544120,"avatar_url":"https://avatars.githubusercontent.com/u/16544120?v=3","gravatar_id":"","url":"https://api.github.com/users/RaduBerinde","html_url":"https://github.com/RaduBerinde","followers_url":"https://api.github.com/users/RaduBerinde/followers","following_url":"https://api.github.com/users/RaduBerinde/following{/other_user}","gists_url":"https://api.github.com/users/RaduBerinde/gists{/gist_id}","starred_url":"https://api.github.com/users/RaduBerinde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaduBerinde/subscriptions","organizations_url":"https://api.github.com/users/RaduBerinde/orgs","repos_url":"https://api.github.com/users/RaduBerinde/repos","events_url":"https://api.github.com/users/RaduBerinde/events{/privacy}","received_events_url":"https://api.github.com/users/RaduBerinde/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T11:40:48Z","updated_at":"2016-09-09T11:40:48Z","body":"We wouldn't add a `level` argument to the methods in the interface of batch (the exported ones, including `AddRawRequest`). These methods would pass a level of 1 to identify their caller.\r\n\r\nThe usual convention with level is that if function `X` calls function Y(level), it wants whatever `Y` ends up logging to reflect the caller that is `level` above `X`. So `level=1` means X's caller, `level=2` means X's caller's caller. A good example is the [logging code itself](https://github.com/cockroachdb/cockroach/blob/0cee5fa91868456d1e45a8b817b27d6033f0a4ba/util/log/log.go#L107).\r\n\r\nOk, so in our case, `appendReqs` would take a `level`. It would call `logRequest(level+1)`, and `logRequest` would in turn calll `VDepth` and `InfofDepth` with `level+1` (which is 2 more than the level that was passed to `appendReqs`).\r\n\r\nAddRawRequest would call appendReqs with level=1, meaning it wants whoever called `AddRawRequest` to show up in  the log. All \"top-level\" functions that call `appendReqs` directly would do the same. Functions like `put` would call `appendReqs` with level=2, so that we show the caller's caller, i.e. the caller of `Put/Putinline`.\r\n\r\nHope this helps. Thanks!"}}
{"actor":{"display_login":"RaduBerinde"}}