{"action":"created","comment":{"url":"https://api.github.com/repos/dash-project/dash/pulls/comments/105197847","pull_request_review_id":26065672,"id":105197847,"diff_hunk":"@@ -22,3 +39,84 @@ const int dart__base__unit_term_colors[DART_LOG_TCOL_NUM_CODES-1] = {\n   DART_LOG_TCOL_RED,\n   DART_LOG_TCOL_BLUE\n };\n+\n+static const char *loglevel_names[DART_LOGLEVEL_NUM_LEVEL] = {\n+    \"ERROR\",\n+    \"WARN\",\n+    \"INFO\",\n+    \"DEBUG\",\n+    \"TRACE\"\n+};\n+\n+static\n+enum dart__base__logging_loglevel\n+env_loglevel()\n+{\n+  static enum dart__base__logging_loglevel level = DART_LOGLEVEL_TRACE;\n+  static int log_level_parsed = 0;\n+  if (!log_level_parsed) {\n+    const char *envstr = getenv(DART_LOGLEVEL_ENVSTR);\n+    if (envstr) {\n+      if (strcmp(envstr, \"ERROR\") == 0) {\n+        level = DART_LOGLEVEL_ERROR;\n+      } else if (strcmp(envstr, \"WARN\") == 0) {\n+        level = DART_LOGLEVEL_WARN;\n+      } else if (strcmp(envstr, \"INFO\") == 0) {\n+        level = DART_LOGLEVEL_INFO;\n+      } else if (strcmp(envstr, \"DEBUG\") == 0) {\n+        level = DART_LOGLEVEL_DEBUG;\n+      } else if (strcmp(envstr, \"TRACE\") == 0) {\n+        level = DART_LOGLEVEL_TRACE;\n+      }\n+    }\n+  }\n+\n+  return level;\n+}\n+\n+/* GNU variant of basename.3 */\n+static inline\n+const char * dart_base_logging_basename(const char *path) {\n+    char *base = strrchr(path, '/');\n+    return base ? base+1 : path;\n+}\n+\n+void\n+dart__logging__message(\n+  const char *filename,\n+  int         line,\n+  int         level,\n+  const char *format,\n+  ...\n+)\n+{\n+  if (level > env_loglevel() ||\n+      level > DART_LOGLEVEL_TRACE) {\n+    return;\n+  }\n+  va_list argp;\n+  va_start(argp, format);\n+  const int maxlen = DASH__DART_LOGGING__MAX_MESSAGE_LENGTH;\n+  int       sn_ret;\n+  char      msg_buf[maxlen];\n+  pid_t     pid = getpid();\n+  sn_ret = vsnprintf(msg_buf, maxlen, format, argp);\n+//  if (sn_ret < 0 || sn_ret >= maxlen) {\n+//    break;\n+//  }\n+  dart_global_unit_t unit_id;\n+  dart_myid(&unit_id);\n+  // avoid inter-thread log interference\n+  dart_mutex_lock(&logmutex);","path":"dart-impl/base/src/logging.c","position":null,"original_position":97,"commit_id":"f918db6e3299d6656b228d87b07443b4f112e352","original_commit_id":"2fcdb4403e62d44105de5a02ef64e7f2d6e930ea","user":{"login":"fuchsto","id":37075,"avatar_url":"https://avatars1.githubusercontent.com/u/37075?v=3","gravatar_id":"","url":"https://api.github.com/users/fuchsto","html_url":"https://github.com/fuchsto","followers_url":"https://api.github.com/users/fuchsto/followers","following_url":"https://api.github.com/users/fuchsto/following{/other_user}","gists_url":"https://api.github.com/users/fuchsto/gists{/gist_id}","starred_url":"https://api.github.com/users/fuchsto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fuchsto/subscriptions","organizations_url":"https://api.github.com/users/fuchsto/orgs","repos_url":"https://api.github.com/users/fuchsto/repos","events_url":"https://api.github.com/users/fuchsto/events{/privacy}","received_events_url":"https://api.github.com/users/fuchsto/received_events","type":"User","site_admin":false},"body":"Me neither, but it's all we got. Life is hard without colons.","created_at":"2017-03-09T15:56:25Z","updated_at":"2017-03-09T15:56:25Z","html_url":"https://github.com/dash-project/dash/pull/316#discussion_r105197847","pull_request_url":"https://api.github.com/repos/dash-project/dash/pulls/316","_links":{"self":{"href":"https://api.github.com/repos/dash-project/dash/pulls/comments/105197847"},"html":{"href":"https://github.com/dash-project/dash/pull/316#discussion_r105197847"},"pull_request":{"href":"https://api.github.com/repos/dash-project/dash/pulls/316"}}},"pull_request":{"url":"https://api.github.com/repos/dash-project/dash/pulls/316","id":109590908,"html_url":"https://github.com/dash-project/dash/pull/316","diff_url":"https://github.com/dash-project/dash/pull/316.diff","patch_url":"https://github.com/dash-project/dash/pull/316.patch","issue_url":"https://api.github.com/repos/dash-project/dash/issues/316","number":316,"state":"open","locked":false,"title":"Introduce Log-levels in DART (2)","user":{"login":"devreal","id":10974502,"avatar_url":"https://avatars2.githubusercontent.com/u/10974502?v=3","gravatar_id":"","url":"https://api.github.com/users/devreal","html_url":"https://github.com/devreal","followers_url":"https://api.github.com/users/devreal/followers","following_url":"https://api.github.com/users/devreal/following{/other_user}","gists_url":"https://api.github.com/users/devreal/gists{/gist_id}","starred_url":"https://api.github.com/users/devreal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devreal/subscriptions","organizations_url":"https://api.github.com/users/devreal/orgs","repos_url":"https://api.github.com/users/devreal/repos","events_url":"https://api.github.com/users/devreal/events{/privacy}","received_events_url":"https://api.github.com/users/devreal/received_events","type":"User","site_admin":false},"body":"Giving this another shot (refer to #247 for previous discussion). This PR adds the following on top of it:\r\n\r\n1. Resolve `DART_LOG*` functions to a single function call (`printf`-style argument checking is preserved). This yields some significant savings in binary size (151kB vs 240kB for `libdart-mpi.a` with debug output enabled)\r\n2. Ensure mutual exclusion between threads to avoid interleaved log output. \r\n3. A bunch of fixes to format specifier.\r\n4. Do not silently drop overlong log messages but print truncate line. It's up to the developer to fix them.\r\n\r\nRelated to #109 ","created_at":"2017-03-07T22:56:31Z","updated_at":"2017-03-09T15:56:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9becf885ea5e5d3ae41a37e0b22bbba94569125","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dash-project/dash/pulls/316/commits","review_comments_url":"https://api.github.com/repos/dash-project/dash/pulls/316/comments","review_comment_url":"https://api.github.com/repos/dash-project/dash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dash-project/dash/issues/316/comments","statuses_url":"https://api.github.com/repos/dash-project/dash/statuses/f918db6e3299d6656b228d87b07443b4f112e352","head":{"label":"dash-project:feat-dart-loglevel","ref":"feat-dart-loglevel","sha":"f918db6e3299d6656b228d87b07443b4f112e352","user":{"login":"dash-project","id":14168660,"avatar_url":"https://avatars0.githubusercontent.com/u/14168660?v=3","gravatar_id":"","url":"https://api.github.com/users/dash-project","html_url":"https://github.com/dash-project","followers_url":"https://api.github.com/users/dash-project/followers","following_url":"https://api.github.com/users/dash-project/following{/other_user}","gists_url":"https://api.github.com/users/dash-project/gists{/gist_id}","starred_url":"https://api.github.com/users/dash-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dash-project/subscriptions","organizations_url":"https://api.github.com/users/dash-project/orgs","repos_url":"https://api.github.com/users/dash-project/repos","events_url":"https://api.github.com/users/dash-project/events{/privacy}","received_events_url":"https://api.github.com/users/dash-project/received_events","type":"Organization","site_admin":false},"repo":{"id":45930061,"name":"dash","full_name":"dash-project/dash","owner":{"login":"dash-project","id":14168660,"avatar_url":"https://avatars0.githubusercontent.com/u/14168660?v=3","gravatar_id":"","url":"https://api.github.com/users/dash-project","html_url":"https://github.com/dash-project","followers_url":"https://api.github.com/users/dash-project/followers","following_url":"https://api.github.com/users/dash-project/following{/other_user}","gists_url":"https://api.github.com/users/dash-project/gists{/gist_id}","starred_url":"https://api.github.com/users/dash-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dash-project/subscriptions","organizations_url":"https://api.github.com/users/dash-project/orgs","repos_url":"https://api.github.com/users/dash-project/repos","events_url":"https://api.github.com/users/dash-project/events{/privacy}","received_events_url":"https://api.github.com/users/dash-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dash-project/dash","description":"DASH, the C++ Template Library for Distributed Data Structures with Support for Hierarchical Locality for HPC and Data-Driven Science","fork":false,"url":"https://api.github.com/repos/dash-project/dash","forks_url":"https://api.github.com/repos/dash-project/dash/forks","keys_url":"https://api.github.com/repos/dash-project/dash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dash-project/dash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dash-project/dash/teams","hooks_url":"https://api.github.com/repos/dash-project/dash/hooks","issue_events_url":"https://api.github.com/repos/dash-project/dash/issues/events{/number}","events_url":"https://api.github.com/repos/dash-project/dash/events","assignees_url":"https://api.github.com/repos/dash-project/dash/assignees{/user}","branches_url":"https://api.github.com/repos/dash-project/dash/branches{/branch}","tags_url":"https://api.github.com/repos/dash-project/dash/tags","blobs_url":"https://api.github.com/repos/dash-project/dash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dash-project/dash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dash-project/dash/git/refs{/sha}","trees_url":"https://api.github.com/repos/dash-project/dash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dash-project/dash/statuses/{sha}","languages_url":"https://api.github.com/repos/dash-project/dash/languages","stargazers_url":"https://api.github.com/repos/dash-project/dash/stargazers","contributors_url":"https://api.github.com/repos/dash-project/dash/contributors","subscribers_url":"https://api.github.com/repos/dash-project/dash/subscribers","subscription_url":"https://api.github.com/repos/dash-project/dash/subscription","commits_url":"https://api.github.com/repos/dash-project/dash/commits{/sha}","git_commits_url":"https://api.github.com/repos/dash-project/dash/git/commits{/sha}","comments_url":"https://api.github.com/repos/dash-project/dash/comments{/number}","issue_comment_url":"https://api.github.com/repos/dash-project/dash/issues/comments{/number}","contents_url":"https://api.github.com/repos/dash-project/dash/contents/{+path}","compare_url":"https://api.github.com/repos/dash-project/dash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dash-project/dash/merges","archive_url":"https://api.github.com/repos/dash-project/dash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dash-project/dash/downloads","issues_url":"https://api.github.com/repos/dash-project/dash/issues{/number}","pulls_url":"https://api.github.com/repos/dash-project/dash/pulls{/number}","milestones_url":"https://api.github.com/repos/dash-project/dash/milestones{/number}","notifications_url":"https://api.github.com/repos/dash-project/dash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dash-project/dash/labels{/name}","releases_url":"https://api.github.com/repos/dash-project/dash/releases{/id}","deployments_url":"https://api.github.com/repos/dash-project/dash/deployments","created_at":"2015-11-10T17:56:37Z","updated_at":"2017-03-08T23:48:57Z","pushed_at":"2017-03-09T15:26:11Z","git_url":"git://github.com/dash-project/dash.git","ssh_url":"git@github.com:dash-project/dash.git","clone_url":"https://github.com/dash-project/dash.git","svn_url":"https://github.com/dash-project/dash","homepage":"http://www.dash-project.org/","size":9134,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":41,"forks":15,"open_issues":41,"watchers":29,"default_branch":"development"}},"base":{"label":"dash-project:development","ref":"development","sha":"66a1a82340f71f3725d6e359067b99bc91ba1878","user":{"login":"dash-project","id":14168660,"avatar_url":"https://avatars0.githubusercontent.com/u/14168660?v=3","gravatar_id":"","url":"https://api.github.com/users/dash-project","html_url":"https://github.com/dash-project","followers_url":"https://api.github.com/users/dash-project/followers","following_url":"https://api.github.com/users/dash-project/following{/other_user}","gists_url":"https://api.github.com/users/dash-project/gists{/gist_id}","starred_url":"https://api.github.com/users/dash-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dash-project/subscriptions","organizations_url":"https://api.github.com/users/dash-project/orgs","repos_url":"https://api.github.com/users/dash-project/repos","events_url":"https://api.github.com/users/dash-project/events{/privacy}","received_events_url":"https://api.github.com/users/dash-project/received_events","type":"Organization","site_admin":false},"repo":{"id":45930061,"name":"dash","full_name":"dash-project/dash","owner":{"login":"dash-project","id":14168660,"avatar_url":"https://avatars0.githubusercontent.com/u/14168660?v=3","gravatar_id":"","url":"https://api.github.com/users/dash-project","html_url":"https://github.com/dash-project","followers_url":"https://api.github.com/users/dash-project/followers","following_url":"https://api.github.com/users/dash-project/following{/other_user}","gists_url":"https://api.github.com/users/dash-project/gists{/gist_id}","starred_url":"https://api.github.com/users/dash-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dash-project/subscriptions","organizations_url":"https://api.github.com/users/dash-project/orgs","repos_url":"https://api.github.com/users/dash-project/repos","events_url":"https://api.github.com/users/dash-project/events{/privacy}","received_events_url":"https://api.github.com/users/dash-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dash-project/dash","description":"DASH, the C++ Template Library for Distributed Data Structures with Support for Hierarchical Locality for HPC and Data-Driven Science","fork":false,"url":"https://api.github.com/repos/dash-project/dash","forks_url":"https://api.github.com/repos/dash-project/dash/forks","keys_url":"https://api.github.com/repos/dash-project/dash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dash-project/dash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dash-project/dash/teams","hooks_url":"https://api.github.com/repos/dash-project/dash/hooks","issue_events_url":"https://api.github.com/repos/dash-project/dash/issues/events{/number}","events_url":"https://api.github.com/repos/dash-project/dash/events","assignees_url":"https://api.github.com/repos/dash-project/dash/assignees{/user}","branches_url":"https://api.github.com/repos/dash-project/dash/branches{/branch}","tags_url":"https://api.github.com/repos/dash-project/dash/tags","blobs_url":"https://api.github.com/repos/dash-project/dash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dash-project/dash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dash-project/dash/git/refs{/sha}","trees_url":"https://api.github.com/repos/dash-project/dash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dash-project/dash/statuses/{sha}","languages_url":"https://api.github.com/repos/dash-project/dash/languages","stargazers_url":"https://api.github.com/repos/dash-project/dash/stargazers","contributors_url":"https://api.github.com/repos/dash-project/dash/contributors","subscribers_url":"https://api.github.com/repos/dash-project/dash/subscribers","subscription_url":"https://api.github.com/repos/dash-project/dash/subscription","commits_url":"https://api.github.com/repos/dash-project/dash/commits{/sha}","git_commits_url":"https://api.github.com/repos/dash-project/dash/git/commits{/sha}","comments_url":"https://api.github.com/repos/dash-project/dash/comments{/number}","issue_comment_url":"https://api.github.com/repos/dash-project/dash/issues/comments{/number}","contents_url":"https://api.github.com/repos/dash-project/dash/contents/{+path}","compare_url":"https://api.github.com/repos/dash-project/dash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dash-project/dash/merges","archive_url":"https://api.github.com/repos/dash-project/dash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dash-project/dash/downloads","issues_url":"https://api.github.com/repos/dash-project/dash/issues{/number}","pulls_url":"https://api.github.com/repos/dash-project/dash/pulls{/number}","milestones_url":"https://api.github.com/repos/dash-project/dash/milestones{/number}","notifications_url":"https://api.github.com/repos/dash-project/dash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dash-project/dash/labels{/name}","releases_url":"https://api.github.com/repos/dash-project/dash/releases{/id}","deployments_url":"https://api.github.com/repos/dash-project/dash/deployments","created_at":"2015-11-10T17:56:37Z","updated_at":"2017-03-08T23:48:57Z","pushed_at":"2017-03-09T15:26:11Z","git_url":"git://github.com/dash-project/dash.git","ssh_url":"git@github.com:dash-project/dash.git","clone_url":"https://github.com/dash-project/dash.git","svn_url":"https://github.com/dash-project/dash","homepage":"http://www.dash-project.org/","size":9134,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":41,"forks":15,"open_issues":41,"watchers":29,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/dash-project/dash/pulls/316"},"html":{"href":"https://github.com/dash-project/dash/pull/316"},"issue":{"href":"https://api.github.com/repos/dash-project/dash/issues/316"},"comments":{"href":"https://api.github.com/repos/dash-project/dash/issues/316/comments"},"review_comments":{"href":"https://api.github.com/repos/dash-project/dash/pulls/316/comments"},"review_comment":{"href":"https://api.github.com/repos/dash-project/dash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dash-project/dash/pulls/316/commits"},"statuses":{"href":"https://api.github.com/repos/dash-project/dash/statuses/f918db6e3299d6656b228d87b07443b4f112e352"}}}}
{"actor":{"display_login":"fuchsto"}}