{"action":"created","comment":{"url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/comments/211069846","pull_request_review_id":147424218,"id":211069846,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTA2OTg0Ng==","diff_hunk":"@@ -50,10 +54,63 @@ namespace ray {\n \n namespace internal {\n \n-class NullLog {\n+// To make the logging lib plugable with other logging lib and make \n+// the implementation unawared by the user, RayLog is only a declaration\n+// which hide the implementation into logging.cc file.\n+// In logging.cc, we can choose different log lib using different macroes.\n+class RayLogBase {\n  public:\n+  virtual ~RayLogBase() {};\n+  template<typename T>\n+  RayLogBase &operator<<(const T &t) {\n+    RAY_IGNORE_EXPR(t);\n+    return *this;\n+  }\n+};\n+\n+class RayLog : public RayLogBase {\n+ public:\n+  RayLog(const char *file_name, int line_number, int severity);\n+  virtual ~RayLog();\n+  template<typename T>\n+  RayLogBase &operator<<(const T &t) {\n+    if (implement == nullptr) {\n+      RAY_IGNORE_EXPR(t);\n+    } else {\n+      this->stream() << t;\n+    }\n+    return *this;\n+  }\n+  static void StartRayLog(const char *appName, int severity_threshold = RAY_ERROR, const char* logDir = \"/tmp/\");\n+  static void ShutDownRayLog();\n+  static void *GetImplPointer();\n+  static void SetImplPointer(void *pointer);\n+ private:\n+  std::ostream& stream();\n+  const char *file_name_;\n+  int line_number_;\n+  int severity_;\n+  void *implement;\n+  static void *static_impl;\n+  static int severity_threshold_;\n+};\n+\n+// Clang-tidy isn't smart enough to determine that DCHECK using CerrLog doesn't\n+// return so we create a new class to give it a hint.\n+class RayFatalLog : public RayLog {\n+ public:\n+  explicit RayFatalLog(const char *file_name, int line_number)  // NOLINT","path":"src/ray/util/logging.h","position":80,"original_position":80,"commit_id":"aa8cf5064403829bbe3b9f7d8d7467659ab837ea","original_commit_id":"aa8cf5064403829bbe3b9f7d8d7467659ab837ea","user":{"login":"jovan-wong","id":19473861,"node_id":"MDQ6VXNlcjE5NDczODYx","avatar_url":"https://avatars0.githubusercontent.com/u/19473861?v=4","gravatar_id":"","url":"https://api.github.com/users/jovan-wong","html_url":"https://github.com/jovan-wong","followers_url":"https://api.github.com/users/jovan-wong/followers","following_url":"https://api.github.com/users/jovan-wong/following{/other_user}","gists_url":"https://api.github.com/users/jovan-wong/gists{/gist_id}","starred_url":"https://api.github.com/users/jovan-wong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jovan-wong/subscriptions","organizations_url":"https://api.github.com/users/jovan-wong/orgs","repos_url":"https://api.github.com/users/jovan-wong/repos","events_url":"https://api.github.com/users/jovan-wong/events{/privacy}","received_events_url":"https://api.github.com/users/jovan-wong/received_events","type":"User","site_admin":false},"body":"Ctor with 2 parameters doesn't need  `explicit`.","created_at":"2018-08-18T09:13:47Z","updated_at":"2018-08-18T09:17:16Z","html_url":"https://github.com/ant-tech-alliance/ray/pull/75#discussion_r211069846","pull_request_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/comments/211069846"},"html":{"href":"https://github.com/ant-tech-alliance/ray/pull/75#discussion_r211069846"},"pull_request":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75"}}},"pull_request":{"url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75","id":209168889,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MTY4ODg5","html_url":"https://github.com/ant-tech-alliance/ray/pull/75","diff_url":"https://github.com/ant-tech-alliance/ray/pull/75.diff","patch_url":"https://github.com/ant-tech-alliance/ray/pull/75.patch","issue_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/75","number":75,"state":"open","locked":false,"title":"[WIP] Support different backend C++ log lib","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},"body":"<!--\r\nThank you for your contribution!\r\n\r\nPlease review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request.\r\n-->\r\n\r\n## What do these changes do?\r\nCurrent Ray backend log is very simple and cannot supporting severity control in runtime. This change make ray backend pluggable with different log libs. Currently, the supporting libs are Ray original log, `glog`, `log4cplus`. The user can use cmake option (`RAY_USE_GLOG` or `RAY_USE_LOG4CPLUS`) to control which lib to be used. \r\n```c++\r\n  RAY_LOG(DEBUG) << \"This is the DEBUG message\";\r\n  RAY_LOG(INFO) << \"This is the INFO message\";\r\n  RAY_LOG(WARNING) << \"This is the WARNING message\";\r\n  RAY_LOG(ERROR) << \"This is the ERROR message\";\r\n```\r\nFor above code, the output results are:\r\n1. Ray original log:\r\n```bash\r\nThis is the DEBUG message\r\n/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:12: This is the INFO message\r\n/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:13: This is the WARNING message\r\n/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:14: This is the ERROR message\r\n```\r\n2. glog:\r\n```bash\r\nI0817 22:11:54.285164 2564998016 logging_test.cc:11] This is the DEBUG message\r\nI0817 22:11:54.285908 2564998016 logging_test.cc:12] This is the INFO message\r\nW0817 22:11:54.285918 2564998016 logging_test.cc:13] This is the WARNING message\r\nE0817 22:11:54.285924 2564998016 logging_test.cc:14] This is the ERROR message\r\n```\r\n\r\n2. log4cplus:\r\n```bash\r\n08/17/18 12:11:03  - This is the DEBUG message [/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:11]\r\n08/17/18 12:11:03  - This is the INFO message [/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:12]\r\n08/17/18 12:11:03  - This is the WARNING message [/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:13]\r\n08/17/18 12:11:03  - This is the ERROR message [/Users/yuhguo/git/ray/src/ray/util/logging_test.cc:14]\r\n```\r\nComparison among different libs:\r\n1. Ray original lib is light-weight, but cannot specify severity threshold in runtime, so sometimes it is verbose. Furthermore, the log file is the redirect result of stdout and stderr, it is hard to split log among different severities.\r\n2. `glog` has the benefit of output logs according to severity at runtime, but the log format cannot be changed.\r\n3. `log4cplus` support user-defined format, but the perf could be a problem.\r\n\r\nNext step:\r\n1. Normalize the severity level among different libs\r\n2. Remove duplicated code\r\n3. Add perf test to different logs\r\n\r\n<!-- Please give a short brief about these changes. -->\r\n\r\n## Related issue number\r\n\r\n<!-- Are there any issues opened that will be resolved by merging this change? -->\r\n","created_at":"2018-08-17T14:40:20Z","updated_at":"2018-08-18T09:17:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"468a311db35fd2d866a8d94a816cc2301e5ddf05","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75/commits","review_comments_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75/comments","review_comment_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/75/comments","statuses_url":"https://api.github.com/repos/ant-tech-alliance/ray/statuses/aa8cf5064403829bbe3b9f7d8d7467659ab837ea","head":{"label":"ant-tech-alliance:glog","ref":"glog","sha":"aa8cf5064403829bbe3b9f7d8d7467659ab837ea","user":{"login":"ant-tech-alliance","id":29560905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NTYwOTA1","avatar_url":"https://avatars3.githubusercontent.com/u/29560905?v=4","gravatar_id":"","url":"https://api.github.com/users/ant-tech-alliance","html_url":"https://github.com/ant-tech-alliance","followers_url":"https://api.github.com/users/ant-tech-alliance/followers","following_url":"https://api.github.com/users/ant-tech-alliance/following{/other_user}","gists_url":"https://api.github.com/users/ant-tech-alliance/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-tech-alliance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-tech-alliance/subscriptions","organizations_url":"https://api.github.com/users/ant-tech-alliance/orgs","repos_url":"https://api.github.com/users/ant-tech-alliance/repos","events_url":"https://api.github.com/users/ant-tech-alliance/events{/privacy}","received_events_url":"https://api.github.com/users/ant-tech-alliance/received_events","type":"Organization","site_admin":false},"repo":{"id":125461261,"node_id":"MDEwOlJlcG9zaXRvcnkxMjU0NjEyNjE=","name":"ray","full_name":"ant-tech-alliance/ray","owner":{"login":"ant-tech-alliance","id":29560905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NTYwOTA1","avatar_url":"https://avatars3.githubusercontent.com/u/29560905?v=4","gravatar_id":"","url":"https://api.github.com/users/ant-tech-alliance","html_url":"https://github.com/ant-tech-alliance","followers_url":"https://api.github.com/users/ant-tech-alliance/followers","following_url":"https://api.github.com/users/ant-tech-alliance/following{/other_user}","gists_url":"https://api.github.com/users/ant-tech-alliance/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-tech-alliance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-tech-alliance/subscriptions","organizations_url":"https://api.github.com/users/ant-tech-alliance/orgs","repos_url":"https://api.github.com/users/ant-tech-alliance/repos","events_url":"https://api.github.com/users/ant-tech-alliance/events{/privacy}","received_events_url":"https://api.github.com/users/ant-tech-alliance/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ant-tech-alliance/ray","description":"A high-performance distributed execution engine","fork":true,"url":"https://api.github.com/repos/ant-tech-alliance/ray","forks_url":"https://api.github.com/repos/ant-tech-alliance/ray/forks","keys_url":"https://api.github.com/repos/ant-tech-alliance/ray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ant-tech-alliance/ray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ant-tech-alliance/ray/teams","hooks_url":"https://api.github.com/repos/ant-tech-alliance/ray/hooks","issue_events_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/events{/number}","events_url":"https://api.github.com/repos/ant-tech-alliance/ray/events","assignees_url":"https://api.github.com/repos/ant-tech-alliance/ray/assignees{/user}","branches_url":"https://api.github.com/repos/ant-tech-alliance/ray/branches{/branch}","tags_url":"https://api.github.com/repos/ant-tech-alliance/ray/tags","blobs_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/refs{/sha}","trees_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ant-tech-alliance/ray/statuses/{sha}","languages_url":"https://api.github.com/repos/ant-tech-alliance/ray/languages","stargazers_url":"https://api.github.com/repos/ant-tech-alliance/ray/stargazers","contributors_url":"https://api.github.com/repos/ant-tech-alliance/ray/contributors","subscribers_url":"https://api.github.com/repos/ant-tech-alliance/ray/subscribers","subscription_url":"https://api.github.com/repos/ant-tech-alliance/ray/subscription","commits_url":"https://api.github.com/repos/ant-tech-alliance/ray/commits{/sha}","git_commits_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/commits{/sha}","comments_url":"https://api.github.com/repos/ant-tech-alliance/ray/comments{/number}","issue_comment_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/comments{/number}","contents_url":"https://api.github.com/repos/ant-tech-alliance/ray/contents/{+path}","compare_url":"https://api.github.com/repos/ant-tech-alliance/ray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ant-tech-alliance/ray/merges","archive_url":"https://api.github.com/repos/ant-tech-alliance/ray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ant-tech-alliance/ray/downloads","issues_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues{/number}","pulls_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls{/number}","milestones_url":"https://api.github.com/repos/ant-tech-alliance/ray/milestones{/number}","notifications_url":"https://api.github.com/repos/ant-tech-alliance/ray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ant-tech-alliance/ray/labels{/name}","releases_url":"https://api.github.com/repos/ant-tech-alliance/ray/releases{/id}","deployments_url":"https://api.github.com/repos/ant-tech-alliance/ray/deployments","created_at":"2018-03-16T03:58:55Z","updated_at":"2018-08-17T05:44:45Z","pushed_at":"2018-08-17T18:48:19Z","git_url":"git://github.com/ant-tech-alliance/ray.git","ssh_url":"git@github.com:ant-tech-alliance/ray.git","clone_url":"https://github.com/ant-tech-alliance/ray.git","svn_url":"https://github.com/ant-tech-alliance/ray","homepage":"","size":15056,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":6,"open_issues":9,"watchers":8,"default_branch":"master"}},"base":{"label":"ant-tech-alliance:yuhong-stage","ref":"yuhong-stage","sha":"079c4e482acd1300d65505543d1511b141e9bd30","user":{"login":"ant-tech-alliance","id":29560905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NTYwOTA1","avatar_url":"https://avatars3.githubusercontent.com/u/29560905?v=4","gravatar_id":"","url":"https://api.github.com/users/ant-tech-alliance","html_url":"https://github.com/ant-tech-alliance","followers_url":"https://api.github.com/users/ant-tech-alliance/followers","following_url":"https://api.github.com/users/ant-tech-alliance/following{/other_user}","gists_url":"https://api.github.com/users/ant-tech-alliance/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-tech-alliance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-tech-alliance/subscriptions","organizations_url":"https://api.github.com/users/ant-tech-alliance/orgs","repos_url":"https://api.github.com/users/ant-tech-alliance/repos","events_url":"https://api.github.com/users/ant-tech-alliance/events{/privacy}","received_events_url":"https://api.github.com/users/ant-tech-alliance/received_events","type":"Organization","site_admin":false},"repo":{"id":125461261,"node_id":"MDEwOlJlcG9zaXRvcnkxMjU0NjEyNjE=","name":"ray","full_name":"ant-tech-alliance/ray","owner":{"login":"ant-tech-alliance","id":29560905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NTYwOTA1","avatar_url":"https://avatars3.githubusercontent.com/u/29560905?v=4","gravatar_id":"","url":"https://api.github.com/users/ant-tech-alliance","html_url":"https://github.com/ant-tech-alliance","followers_url":"https://api.github.com/users/ant-tech-alliance/followers","following_url":"https://api.github.com/users/ant-tech-alliance/following{/other_user}","gists_url":"https://api.github.com/users/ant-tech-alliance/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-tech-alliance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-tech-alliance/subscriptions","organizations_url":"https://api.github.com/users/ant-tech-alliance/orgs","repos_url":"https://api.github.com/users/ant-tech-alliance/repos","events_url":"https://api.github.com/users/ant-tech-alliance/events{/privacy}","received_events_url":"https://api.github.com/users/ant-tech-alliance/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ant-tech-alliance/ray","description":"A high-performance distributed execution engine","fork":true,"url":"https://api.github.com/repos/ant-tech-alliance/ray","forks_url":"https://api.github.com/repos/ant-tech-alliance/ray/forks","keys_url":"https://api.github.com/repos/ant-tech-alliance/ray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ant-tech-alliance/ray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ant-tech-alliance/ray/teams","hooks_url":"https://api.github.com/repos/ant-tech-alliance/ray/hooks","issue_events_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/events{/number}","events_url":"https://api.github.com/repos/ant-tech-alliance/ray/events","assignees_url":"https://api.github.com/repos/ant-tech-alliance/ray/assignees{/user}","branches_url":"https://api.github.com/repos/ant-tech-alliance/ray/branches{/branch}","tags_url":"https://api.github.com/repos/ant-tech-alliance/ray/tags","blobs_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/refs{/sha}","trees_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ant-tech-alliance/ray/statuses/{sha}","languages_url":"https://api.github.com/repos/ant-tech-alliance/ray/languages","stargazers_url":"https://api.github.com/repos/ant-tech-alliance/ray/stargazers","contributors_url":"https://api.github.com/repos/ant-tech-alliance/ray/contributors","subscribers_url":"https://api.github.com/repos/ant-tech-alliance/ray/subscribers","subscription_url":"https://api.github.com/repos/ant-tech-alliance/ray/subscription","commits_url":"https://api.github.com/repos/ant-tech-alliance/ray/commits{/sha}","git_commits_url":"https://api.github.com/repos/ant-tech-alliance/ray/git/commits{/sha}","comments_url":"https://api.github.com/repos/ant-tech-alliance/ray/comments{/number}","issue_comment_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues/comments{/number}","contents_url":"https://api.github.com/repos/ant-tech-alliance/ray/contents/{+path}","compare_url":"https://api.github.com/repos/ant-tech-alliance/ray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ant-tech-alliance/ray/merges","archive_url":"https://api.github.com/repos/ant-tech-alliance/ray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ant-tech-alliance/ray/downloads","issues_url":"https://api.github.com/repos/ant-tech-alliance/ray/issues{/number}","pulls_url":"https://api.github.com/repos/ant-tech-alliance/ray/pulls{/number}","milestones_url":"https://api.github.com/repos/ant-tech-alliance/ray/milestones{/number}","notifications_url":"https://api.github.com/repos/ant-tech-alliance/ray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ant-tech-alliance/ray/labels{/name}","releases_url":"https://api.github.com/repos/ant-tech-alliance/ray/releases{/id}","deployments_url":"https://api.github.com/repos/ant-tech-alliance/ray/deployments","created_at":"2018-03-16T03:58:55Z","updated_at":"2018-08-17T05:44:45Z","pushed_at":"2018-08-17T18:48:19Z","git_url":"git://github.com/ant-tech-alliance/ray.git","ssh_url":"git@github.com:ant-tech-alliance/ray.git","clone_url":"https://github.com/ant-tech-alliance/ray.git","svn_url":"https://github.com/ant-tech-alliance/ray","homepage":"","size":15056,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":6,"open_issues":9,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75"},"html":{"href":"https://github.com/ant-tech-alliance/ray/pull/75"},"issue":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/issues/75"},"comments":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/issues/75/comments"},"review_comments":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75/comments"},"review_comment":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/pulls/75/commits"},"statuses":{"href":"https://api.github.com/repos/ant-tech-alliance/ray/statuses/aa8cf5064403829bbe3b9f7d8d7467659ab837ea"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jovan-wong"}}