{"action":"created","comment":{"url":"https://api.github.com/repos/outr/scribe/pulls/comments/52634132","id":52634132,"diff_hunk":"@@ -1,8 +1,60 @@\n package com.outr.scribe\n \n+import scala.annotation.tailrec\n+\n object Platform {\n+  private val NativeMethod = -2\n+\n   val LineSeparator = System.getProperty(\"line.separator\")\n \n   def formatDate(pattern: String, timestamp: Long): String =\n     pattern.format(timestamp)\n+\n+  /**\n+    * Converts a Throwable to a String representation for output in logging.\n+    */\n+  @tailrec\n+  final def throwable2String(t: Throwable,\n+                             primaryCause: Boolean = true,\n+                             b: StringBuilder = new StringBuilder): String = {\n+    if (!primaryCause) {\n+      b.append(\"Caused by: \")\n+    }\n+    b.append(t.getClass.getName)\n+    if (Option(t.getLocalizedMessage).nonEmpty) {\n+      b.append(\": \")\n+      b.append(t.getLocalizedMessage)\n+    }\n+    b.append(System.getProperty(\"line.separator\"))\n+    writeStackTrace(b, t.getStackTrace)\n+    if (Option(t.getCause).isEmpty) {\n+      b.toString()\n+    } else {\n+      throwable2String(t.getCause, primaryCause = false, b = b)\n+    }\n+  }\n+\n+  @tailrec\n+  private def writeStackTrace(b: StringBuilder, elements: Array[StackTraceElement]): Unit = {\n+    if (elements.nonEmpty) {\n+      val head = elements.head\n+      b.append(\"\\tat \")\n+      b.append(head.getClassName)\n+      b.append('.')\n+      b.append(head.getMethodName)\n+      b.append('(')\n+      if (head.getLineNumber == NativeMethod) {\n+        b.append(\"Native Method\")\n+      } else {\n+        b.append(head.getFileName)\n+        if (head.getLineNumber > 0) {\n+          b.append(':')\n+          b.append(head.getLineNumber)\n+        }\n+      }\n+      b.append(')')\n+      b.append(System.getProperty(\"line.separator\"))","path":"jvm/src/main/scala/com/outr/scribe/Platform.scala","position":56,"original_position":56,"commit_id":"cc4b48e90ce770749d72cac2f7c2ea6cf1f85147","original_commit_id":"cc4b48e90ce770749d72cac2f7c2ea6cf1f85147","user":{"login":"darkfrog26","id":877534,"avatar_url":"https://avatars.githubusercontent.com/u/877534?v=3","gravatar_id":"","url":"https://api.github.com/users/darkfrog26","html_url":"https://github.com/darkfrog26","followers_url":"https://api.github.com/users/darkfrog26/followers","following_url":"https://api.github.com/users/darkfrog26/following{/other_user}","gists_url":"https://api.github.com/users/darkfrog26/gists{/gist_id}","starred_url":"https://api.github.com/users/darkfrog26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkfrog26/subscriptions","organizations_url":"https://api.github.com/users/darkfrog26/orgs","repos_url":"https://api.github.com/users/darkfrog26/repos","events_url":"https://api.github.com/users/darkfrog26/events{/privacy}","received_events_url":"https://api.github.com/users/darkfrog26/received_events","type":"User","site_admin":false},"body":"Good catch","created_at":"2016-02-11T17:18:41Z","updated_at":"2016-02-11T17:18:41Z","html_url":"https://github.com/outr/scribe/pull/5#discussion_r52634132","pull_request_url":"https://api.github.com/repos/outr/scribe/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/outr/scribe/pulls/comments/52634132"},"html":{"href":"https://github.com/outr/scribe/pull/5#discussion_r52634132"},"pull_request":{"href":"https://api.github.com/repos/outr/scribe/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/outr/scribe/pulls/5","id":59062914,"html_url":"https://github.com/outr/scribe/pull/5","diff_url":"https://github.com/outr/scribe/pull/5.diff","patch_url":"https://github.com/outr/scribe/pull/5.patch","issue_url":"https://api.github.com/repos/outr/scribe/issues/5","number":5,"state":"open","locked":false,"title":"Slf4j","user":{"login":"darkfrog26","id":877534,"avatar_url":"https://avatars.githubusercontent.com/u/877534?v=3","gravatar_id":"","url":"https://api.github.com/users/darkfrog26","html_url":"https://github.com/darkfrog26","followers_url":"https://api.github.com/users/darkfrog26/followers","following_url":"https://api.github.com/users/darkfrog26/following{/other_user}","gists_url":"https://api.github.com/users/darkfrog26/gists{/gist_id}","starred_url":"https://api.github.com/users/darkfrog26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkfrog26/subscriptions","organizations_url":"https://api.github.com/users/darkfrog26/orgs","repos_url":"https://api.github.com/users/darkfrog26/repos","events_url":"https://api.github.com/users/darkfrog26/events{/privacy}","received_events_url":"https://api.github.com/users/darkfrog26/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-11T17:13:07Z","updated_at":"2016-02-11T17:18:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aedb27197c0df155c632799a719e6edc99e09fb7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/outr/scribe/pulls/5/commits","review_comments_url":"https://api.github.com/repos/outr/scribe/pulls/5/comments","review_comment_url":"https://api.github.com/repos/outr/scribe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/outr/scribe/issues/5/comments","statuses_url":"https://api.github.com/repos/outr/scribe/statuses/cc4b48e90ce770749d72cac2f7c2ea6cf1f85147","head":{"label":"outr:slf4j","ref":"slf4j","sha":"cc4b48e90ce770749d72cac2f7c2ea6cf1f85147","user":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"repo":{"id":50439358,"name":"scribe","full_name":"outr/scribe","owner":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outr/scribe","description":"Practical logging framework that doesn't depend on any other logging framework and can be completely configured programmatically.","fork":false,"url":"https://api.github.com/repos/outr/scribe","forks_url":"https://api.github.com/repos/outr/scribe/forks","keys_url":"https://api.github.com/repos/outr/scribe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outr/scribe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outr/scribe/teams","hooks_url":"https://api.github.com/repos/outr/scribe/hooks","issue_events_url":"https://api.github.com/repos/outr/scribe/issues/events{/number}","events_url":"https://api.github.com/repos/outr/scribe/events","assignees_url":"https://api.github.com/repos/outr/scribe/assignees{/user}","branches_url":"https://api.github.com/repos/outr/scribe/branches{/branch}","tags_url":"https://api.github.com/repos/outr/scribe/tags","blobs_url":"https://api.github.com/repos/outr/scribe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outr/scribe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outr/scribe/git/refs{/sha}","trees_url":"https://api.github.com/repos/outr/scribe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outr/scribe/statuses/{sha}","languages_url":"https://api.github.com/repos/outr/scribe/languages","stargazers_url":"https://api.github.com/repos/outr/scribe/stargazers","contributors_url":"https://api.github.com/repos/outr/scribe/contributors","subscribers_url":"https://api.github.com/repos/outr/scribe/subscribers","subscription_url":"https://api.github.com/repos/outr/scribe/subscription","commits_url":"https://api.github.com/repos/outr/scribe/commits{/sha}","git_commits_url":"https://api.github.com/repos/outr/scribe/git/commits{/sha}","comments_url":"https://api.github.com/repos/outr/scribe/comments{/number}","issue_comment_url":"https://api.github.com/repos/outr/scribe/issues/comments{/number}","contents_url":"https://api.github.com/repos/outr/scribe/contents/{+path}","compare_url":"https://api.github.com/repos/outr/scribe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outr/scribe/merges","archive_url":"https://api.github.com/repos/outr/scribe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outr/scribe/downloads","issues_url":"https://api.github.com/repos/outr/scribe/issues{/number}","pulls_url":"https://api.github.com/repos/outr/scribe/pulls{/number}","milestones_url":"https://api.github.com/repos/outr/scribe/milestones{/number}","notifications_url":"https://api.github.com/repos/outr/scribe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outr/scribe/labels{/name}","releases_url":"https://api.github.com/repos/outr/scribe/releases{/id}","deployments_url":"https://api.github.com/repos/outr/scribe/deployments","created_at":"2016-01-26T15:49:14Z","updated_at":"2016-01-26T19:27:56Z","pushed_at":"2016-02-11T17:13:07Z","git_url":"git://github.com/outr/scribe.git","ssh_url":"git@github.com:outr/scribe.git","clone_url":"https://github.com/outr/scribe.git","svn_url":"https://github.com/outr/scribe","homepage":null,"size":40,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"outr:master","ref":"master","sha":"6fe33d7ec55878a4313435493e4818b7dd047270","user":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"repo":{"id":50439358,"name":"scribe","full_name":"outr/scribe","owner":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outr/scribe","description":"Practical logging framework that doesn't depend on any other logging framework and can be completely configured programmatically.","fork":false,"url":"https://api.github.com/repos/outr/scribe","forks_url":"https://api.github.com/repos/outr/scribe/forks","keys_url":"https://api.github.com/repos/outr/scribe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outr/scribe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outr/scribe/teams","hooks_url":"https://api.github.com/repos/outr/scribe/hooks","issue_events_url":"https://api.github.com/repos/outr/scribe/issues/events{/number}","events_url":"https://api.github.com/repos/outr/scribe/events","assignees_url":"https://api.github.com/repos/outr/scribe/assignees{/user}","branches_url":"https://api.github.com/repos/outr/scribe/branches{/branch}","tags_url":"https://api.github.com/repos/outr/scribe/tags","blobs_url":"https://api.github.com/repos/outr/scribe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outr/scribe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outr/scribe/git/refs{/sha}","trees_url":"https://api.github.com/repos/outr/scribe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outr/scribe/statuses/{sha}","languages_url":"https://api.github.com/repos/outr/scribe/languages","stargazers_url":"https://api.github.com/repos/outr/scribe/stargazers","contributors_url":"https://api.github.com/repos/outr/scribe/contributors","subscribers_url":"https://api.github.com/repos/outr/scribe/subscribers","subscription_url":"https://api.github.com/repos/outr/scribe/subscription","commits_url":"https://api.github.com/repos/outr/scribe/commits{/sha}","git_commits_url":"https://api.github.com/repos/outr/scribe/git/commits{/sha}","comments_url":"https://api.github.com/repos/outr/scribe/comments{/number}","issue_comment_url":"https://api.github.com/repos/outr/scribe/issues/comments{/number}","contents_url":"https://api.github.com/repos/outr/scribe/contents/{+path}","compare_url":"https://api.github.com/repos/outr/scribe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outr/scribe/merges","archive_url":"https://api.github.com/repos/outr/scribe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outr/scribe/downloads","issues_url":"https://api.github.com/repos/outr/scribe/issues{/number}","pulls_url":"https://api.github.com/repos/outr/scribe/pulls{/number}","milestones_url":"https://api.github.com/repos/outr/scribe/milestones{/number}","notifications_url":"https://api.github.com/repos/outr/scribe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outr/scribe/labels{/name}","releases_url":"https://api.github.com/repos/outr/scribe/releases{/id}","deployments_url":"https://api.github.com/repos/outr/scribe/deployments","created_at":"2016-01-26T15:49:14Z","updated_at":"2016-01-26T19:27:56Z","pushed_at":"2016-02-11T17:13:07Z","git_url":"git://github.com/outr/scribe.git","ssh_url":"git@github.com:outr/scribe.git","clone_url":"https://github.com/outr/scribe.git","svn_url":"https://github.com/outr/scribe","homepage":null,"size":40,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/outr/scribe/pulls/5"},"html":{"href":"https://github.com/outr/scribe/pull/5"},"issue":{"href":"https://api.github.com/repos/outr/scribe/issues/5"},"comments":{"href":"https://api.github.com/repos/outr/scribe/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/outr/scribe/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/outr/scribe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/outr/scribe/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/outr/scribe/statuses/cc4b48e90ce770749d72cac2f7c2ea6cf1f85147"}}}}