{"action":"created","issue":{"url":"https://api.github.com/repos/ray-project/ray/issues/2841","repository_url":"https://api.github.com/repos/ray-project/ray","labels_url":"https://api.github.com/repos/ray-project/ray/issues/2841/labels{/name}","comments_url":"https://api.github.com/repos/ray-project/ray/issues/2841/comments","events_url":"https://api.github.com/repos/ray-project/ray/issues/2841/events","html_url":"https://github.com/ray-project/ray/pull/2841","id":358246252,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MDY1Njgz","number":2841,"title":"Evaluate debug logging only in debug mode","user":{"login":"pcmoritz","id":113316,"node_id":"MDQ6VXNlcjExMzMxNg==","avatar_url":"https://avatars1.githubusercontent.com/u/113316?v=4","gravatar_id":"","url":"https://api.github.com/users/pcmoritz","html_url":"https://github.com/pcmoritz","followers_url":"https://api.github.com/users/pcmoritz/followers","following_url":"https://api.github.com/users/pcmoritz/following{/other_user}","gists_url":"https://api.github.com/users/pcmoritz/gists{/gist_id}","starred_url":"https://api.github.com/users/pcmoritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcmoritz/subscriptions","organizations_url":"https://api.github.com/users/pcmoritz/orgs","repos_url":"https://api.github.com/users/pcmoritz/repos","events_url":"https://api.github.com/users/pcmoritz/events{/privacy}","received_events_url":"https://api.github.com/users/pcmoritz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-09-08T00:19:38Z","updated_at":"2018-09-08T06:28:08Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ray-project/ray/pulls/2841","html_url":"https://github.com/ray-project/ray/pull/2841","diff_url":"https://github.com/ray-project/ray/pull/2841.diff","patch_url":"https://github.com/ray-project/ray/pull/2841.patch"},"body":"This PR makes it so debugging logs are only evaluated during debugging. We found that for the current code, functions called in debug logging code are evaluated even in release mode (even though nothing is printed).\r\n\r\n(see also \"Debug Mode\" in http://rpg.ifi.uzh.ch/docs/glog.html)\r\n\r\ncc @stephanie-wang"},"comment":{"url":"https://api.github.com/repos/ray-project/ray/issues/comments/419617368","html_url":"https://github.com/ray-project/ray/pull/2841#issuecomment-419617368","issue_url":"https://api.github.com/repos/ray-project/ray/issues/2841","id":419617368,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTYxNzM2OA==","user":{"login":"guoyuhong","id":19584326,"node_id":"MDQ6VXNlcjE5NTg0MzI2","avatar_url":"https://avatars2.githubusercontent.com/u/19584326?v=4","gravatar_id":"","url":"https://api.github.com/users/guoyuhong","html_url":"https://github.com/guoyuhong","followers_url":"https://api.github.com/users/guoyuhong/followers","following_url":"https://api.github.com/users/guoyuhong/following{/other_user}","gists_url":"https://api.github.com/users/guoyuhong/gists{/gist_id}","starred_url":"https://api.github.com/users/guoyuhong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guoyuhong/subscriptions","organizations_url":"https://api.github.com/users/guoyuhong/orgs","repos_url":"https://api.github.com/users/guoyuhong/repos","events_url":"https://api.github.com/users/guoyuhong/events{/privacy}","received_events_url":"https://api.github.com/users/guoyuhong/received_events","type":"User","site_admin":false},"created_at":"2018-09-08T06:28:08Z","updated_at":"2018-09-08T06:28:08Z","author_association":"CONTRIBUTOR","body":"Yes, current `RAY_LOG(DEBUG)` will do the evaluation but output nothing, which is a waist of resources.\r\n\r\nIf you don't want to introduce more macros, can the following code be an option? \r\n```c++\r\n#define RAY_LOG_INTERNAL(level) ::ray::RayLog(__FILE__, __LINE__, level)\r\n#ifndef NDEBUG\r\n#define RAY_LOG(level) RAY_LOG_INTERNAL(RAY_##level)\r\n#else\r\n#define RAY_LOG(level) if (RAY_##level != RAY_DEBUG) RAY_LOG_INTERNAL(RAY_##level)\r\n#endif\r\n```"}}
{"actor":{"display_login":"guoyuhong"}}