{"action":"created","comment":{"url":"https://api.github.com/repos/mr-archano/Playground/pulls/comments/30989303","id":30989303,"diff_hunk":"@@ -0,0 +1,11 @@\n+package com.archano.log;\n+\n+import com.archano.log.Log.Level;\n+\n+public interface Logger {","path":"core/src/main/java/com/archano/log/Logger.java","position":5,"original_position":5,"commit_id":"0123d16424e36b2835991e3db74211bbc90c5a6b","original_commit_id":"0123d16424e36b2835991e3db74211bbc90c5a6b","user":{"login":"ataulm","id":2678555,"avatar_url":"https://avatars.githubusercontent.com/u/2678555?v=3","gravatar_id":"","url":"https://api.github.com/users/ataulm","html_url":"https://github.com/ataulm","followers_url":"https://api.github.com/users/ataulm/followers","following_url":"https://api.github.com/users/ataulm/following{/other_user}","gists_url":"https://api.github.com/users/ataulm/gists{/gist_id}","starred_url":"https://api.github.com/users/ataulm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ataulm/subscriptions","organizations_url":"https://api.github.com/users/ataulm/orgs","repos_url":"https://api.github.com/users/ataulm/repos","events_url":"https://api.github.com/users/ataulm/events{/privacy}","received_events_url":"https://api.github.com/users/ataulm/received_events","type":"User","site_admin":false},"body":"what sort of scenarios do you see for having multiple Loggers in a single module?\r\n\r\nI can imagine a Crashlytics logger that only has an implementation for `e` (with no-ops for the rest) but only when they release a version allowing you to send events without an accompanying throwable.","created_at":"2015-05-25T17:48:08Z","updated_at":"2015-05-25T17:48:08Z","html_url":"https://github.com/mr-archano/Playground/pull/1#discussion_r30989303","pull_request_url":"https://api.github.com/repos/mr-archano/Playground/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/comments/30989303"},"html":{"href":"https://github.com/mr-archano/Playground/pull/1#discussion_r30989303"},"pull_request":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/mr-archano/Playground/pulls/1","id":36150755,"html_url":"https://github.com/mr-archano/Playground/pull/1","diff_url":"https://github.com/mr-archano/Playground/pull/1.diff","patch_url":"https://github.com/mr-archano/Playground/pull/1.patch","issue_url":"https://api.github.com/repos/mr-archano/Playground/issues/1","number":1,"state":"open","locked":false,"title":"Adding log facilities","user":{"login":"mr-archano","id":1069201,"avatar_url":"https://avatars.githubusercontent.com/u/1069201?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-archano","html_url":"https://github.com/mr-archano","followers_url":"https://api.github.com/users/mr-archano/followers","following_url":"https://api.github.com/users/mr-archano/following{/other_user}","gists_url":"https://api.github.com/users/mr-archano/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-archano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-archano/subscriptions","organizations_url":"https://api.github.com/users/mr-archano/orgs","repos_url":"https://api.github.com/users/mr-archano/repos","events_url":"https://api.github.com/users/mr-archano/events{/privacy}","received_events_url":"https://api.github.com/users/mr-archano/received_events","type":"User","site_admin":false},"body":"> **Disclaimer**\r\n> The work in this PR is heavily inspired by other projects, and tries to combine the best ideas from:\r\n- Novoda's simple [`Log`](https://github.com/novoda/notils/blob/master/src/main/java/com/novoda/notils/logger/simple/Log.java)  wrapper - included in [NoTils](https://github.com/novoda/notils)\r\n- Jake Wharton's [Timber](https://github.com/JakeWharton/timber)\r\n>\r\n>I just want to use `Log.v(\"whatever\")` in both my Java and Android modules.\r\n\r\nA `Log` class has been defined as a drop-in replacement of `android.util.Log`, but tries to keep the Android dependency out of the core idea, in order to have a single entry point for logs for both `core` and `mobile` modules. At its core `Log` is just a static handle to access logging facilities, but allows to inject as many `Logger` instances as needed and delegate them to actually output the messages. The concern of formatting and deliver the output is delegated to each logger, therefore any behaviour can be potentially added in there as needed. Two `Logger` implementation have been provided:\r\n\r\n- `OutputStremLogger`: it will use a `PrintStream` to output the given messages/throwables. Note this class has only plain Java dependencies, so it's been defined in the `core` module.\r\n\r\n- `AndroidLogger`: it's just a thin wrapper on top of `android.util.Log`, supporting log filtering by priority. All the logs with a priority not specified in the class constructor will be skipped. This will allow to fine tune the level of messages in the output according to any valid heuristic.\r\n\r\nIn order to provide more context to each log, the messages are prefixed with some information about the current stack trace (ie: current thread name, current class, method, line of code). The composition of such information is provided as utility (`FancyLogs#addStackTraceInfoTo(String message, int stackDepth)`) and can be easily reused across different `Logger` implementations. When dealing with lack of information (ie ProGuard-ed classes) the formatting utility will just serve the original message without additional info about the stack trace.\r\n\r\nBy default the `Log` holds an instance of this class using `System.out`, but it exposes a public way to override that setup in a static way. As shown in `PlaygroundApplication` it's easy to override the default behaviour of `Log`, injecting an `AndroidLogger` or disabling every log as needed:\r\n\r\n```java\r\n        ...\r\n        if (BuildConfig.DEBUG) {\r\n            Log.initWith(AndroidLogger.newInstance(TAG, Log.DEFAULT_STACK_DEPTH, Log.ALL_LEVELS));\r\n        } else {\r\n            Log.disable();\r\n        }\r\n        ....\r\n```","created_at":"2015-05-25T17:28:35Z","updated_at":"2015-05-25T17:48:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc39e2057633b61cfd540f567d197faa24e3641e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mr-archano/Playground/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mr-archano/Playground/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mr-archano/Playground/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mr-archano/Playground/issues/1/comments","statuses_url":"https://api.github.com/repos/mr-archano/Playground/statuses/0123d16424e36b2835991e3db74211bbc90c5a6b","head":{"label":"mr-archano:logger","ref":"logger","sha":"0123d16424e36b2835991e3db74211bbc90c5a6b","user":{"login":"mr-archano","id":1069201,"avatar_url":"https://avatars.githubusercontent.com/u/1069201?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-archano","html_url":"https://github.com/mr-archano","followers_url":"https://api.github.com/users/mr-archano/followers","following_url":"https://api.github.com/users/mr-archano/following{/other_user}","gists_url":"https://api.github.com/users/mr-archano/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-archano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-archano/subscriptions","organizations_url":"https://api.github.com/users/mr-archano/orgs","repos_url":"https://api.github.com/users/mr-archano/repos","events_url":"https://api.github.com/users/mr-archano/events{/privacy}","received_events_url":"https://api.github.com/users/mr-archano/received_events","type":"User","site_admin":false},"repo":{"id":29096523,"name":"Playground","full_name":"mr-archano/Playground","owner":{"login":"mr-archano","id":1069201,"avatar_url":"https://avatars.githubusercontent.com/u/1069201?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-archano","html_url":"https://github.com/mr-archano","followers_url":"https://api.github.com/users/mr-archano/followers","following_url":"https://api.github.com/users/mr-archano/following{/other_user}","gists_url":"https://api.github.com/users/mr-archano/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-archano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-archano/subscriptions","organizations_url":"https://api.github.com/users/mr-archano/orgs","repos_url":"https://api.github.com/users/mr-archano/repos","events_url":"https://api.github.com/users/mr-archano/events{/privacy}","received_events_url":"https://api.github.com/users/mr-archano/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mr-archano/Playground","description":"","fork":false,"url":"https://api.github.com/repos/mr-archano/Playground","forks_url":"https://api.github.com/repos/mr-archano/Playground/forks","keys_url":"https://api.github.com/repos/mr-archano/Playground/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mr-archano/Playground/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mr-archano/Playground/teams","hooks_url":"https://api.github.com/repos/mr-archano/Playground/hooks","issue_events_url":"https://api.github.com/repos/mr-archano/Playground/issues/events{/number}","events_url":"https://api.github.com/repos/mr-archano/Playground/events","assignees_url":"https://api.github.com/repos/mr-archano/Playground/assignees{/user}","branches_url":"https://api.github.com/repos/mr-archano/Playground/branches{/branch}","tags_url":"https://api.github.com/repos/mr-archano/Playground/tags","blobs_url":"https://api.github.com/repos/mr-archano/Playground/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mr-archano/Playground/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mr-archano/Playground/git/refs{/sha}","trees_url":"https://api.github.com/repos/mr-archano/Playground/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mr-archano/Playground/statuses/{sha}","languages_url":"https://api.github.com/repos/mr-archano/Playground/languages","stargazers_url":"https://api.github.com/repos/mr-archano/Playground/stargazers","contributors_url":"https://api.github.com/repos/mr-archano/Playground/contributors","subscribers_url":"https://api.github.com/repos/mr-archano/Playground/subscribers","subscription_url":"https://api.github.com/repos/mr-archano/Playground/subscription","commits_url":"https://api.github.com/repos/mr-archano/Playground/commits{/sha}","git_commits_url":"https://api.github.com/repos/mr-archano/Playground/git/commits{/sha}","comments_url":"https://api.github.com/repos/mr-archano/Playground/comments{/number}","issue_comment_url":"https://api.github.com/repos/mr-archano/Playground/issues/comments{/number}","contents_url":"https://api.github.com/repos/mr-archano/Playground/contents/{+path}","compare_url":"https://api.github.com/repos/mr-archano/Playground/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mr-archano/Playground/merges","archive_url":"https://api.github.com/repos/mr-archano/Playground/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mr-archano/Playground/downloads","issues_url":"https://api.github.com/repos/mr-archano/Playground/issues{/number}","pulls_url":"https://api.github.com/repos/mr-archano/Playground/pulls{/number}","milestones_url":"https://api.github.com/repos/mr-archano/Playground/milestones{/number}","notifications_url":"https://api.github.com/repos/mr-archano/Playground/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mr-archano/Playground/labels{/name}","releases_url":"https://api.github.com/repos/mr-archano/Playground/releases{/id}","created_at":"2015-01-11T15:46:18Z","updated_at":"2015-02-15T20:17:24Z","pushed_at":"2015-05-25T17:28:37Z","git_url":"git://github.com/mr-archano/Playground.git","ssh_url":"git@github.com:mr-archano/Playground.git","clone_url":"https://github.com/mr-archano/Playground.git","svn_url":"https://github.com/mr-archano/Playground","homepage":null,"size":358,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mr-archano:develop","ref":"develop","sha":"700020b4e60f0383840c4ca21ca026c779ef15d6","user":{"login":"mr-archano","id":1069201,"avatar_url":"https://avatars.githubusercontent.com/u/1069201?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-archano","html_url":"https://github.com/mr-archano","followers_url":"https://api.github.com/users/mr-archano/followers","following_url":"https://api.github.com/users/mr-archano/following{/other_user}","gists_url":"https://api.github.com/users/mr-archano/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-archano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-archano/subscriptions","organizations_url":"https://api.github.com/users/mr-archano/orgs","repos_url":"https://api.github.com/users/mr-archano/repos","events_url":"https://api.github.com/users/mr-archano/events{/privacy}","received_events_url":"https://api.github.com/users/mr-archano/received_events","type":"User","site_admin":false},"repo":{"id":29096523,"name":"Playground","full_name":"mr-archano/Playground","owner":{"login":"mr-archano","id":1069201,"avatar_url":"https://avatars.githubusercontent.com/u/1069201?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-archano","html_url":"https://github.com/mr-archano","followers_url":"https://api.github.com/users/mr-archano/followers","following_url":"https://api.github.com/users/mr-archano/following{/other_user}","gists_url":"https://api.github.com/users/mr-archano/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-archano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-archano/subscriptions","organizations_url":"https://api.github.com/users/mr-archano/orgs","repos_url":"https://api.github.com/users/mr-archano/repos","events_url":"https://api.github.com/users/mr-archano/events{/privacy}","received_events_url":"https://api.github.com/users/mr-archano/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mr-archano/Playground","description":"","fork":false,"url":"https://api.github.com/repos/mr-archano/Playground","forks_url":"https://api.github.com/repos/mr-archano/Playground/forks","keys_url":"https://api.github.com/repos/mr-archano/Playground/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mr-archano/Playground/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mr-archano/Playground/teams","hooks_url":"https://api.github.com/repos/mr-archano/Playground/hooks","issue_events_url":"https://api.github.com/repos/mr-archano/Playground/issues/events{/number}","events_url":"https://api.github.com/repos/mr-archano/Playground/events","assignees_url":"https://api.github.com/repos/mr-archano/Playground/assignees{/user}","branches_url":"https://api.github.com/repos/mr-archano/Playground/branches{/branch}","tags_url":"https://api.github.com/repos/mr-archano/Playground/tags","blobs_url":"https://api.github.com/repos/mr-archano/Playground/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mr-archano/Playground/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mr-archano/Playground/git/refs{/sha}","trees_url":"https://api.github.com/repos/mr-archano/Playground/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mr-archano/Playground/statuses/{sha}","languages_url":"https://api.github.com/repos/mr-archano/Playground/languages","stargazers_url":"https://api.github.com/repos/mr-archano/Playground/stargazers","contributors_url":"https://api.github.com/repos/mr-archano/Playground/contributors","subscribers_url":"https://api.github.com/repos/mr-archano/Playground/subscribers","subscription_url":"https://api.github.com/repos/mr-archano/Playground/subscription","commits_url":"https://api.github.com/repos/mr-archano/Playground/commits{/sha}","git_commits_url":"https://api.github.com/repos/mr-archano/Playground/git/commits{/sha}","comments_url":"https://api.github.com/repos/mr-archano/Playground/comments{/number}","issue_comment_url":"https://api.github.com/repos/mr-archano/Playground/issues/comments{/number}","contents_url":"https://api.github.com/repos/mr-archano/Playground/contents/{+path}","compare_url":"https://api.github.com/repos/mr-archano/Playground/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mr-archano/Playground/merges","archive_url":"https://api.github.com/repos/mr-archano/Playground/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mr-archano/Playground/downloads","issues_url":"https://api.github.com/repos/mr-archano/Playground/issues{/number}","pulls_url":"https://api.github.com/repos/mr-archano/Playground/pulls{/number}","milestones_url":"https://api.github.com/repos/mr-archano/Playground/milestones{/number}","notifications_url":"https://api.github.com/repos/mr-archano/Playground/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mr-archano/Playground/labels{/name}","releases_url":"https://api.github.com/repos/mr-archano/Playground/releases{/id}","created_at":"2015-01-11T15:46:18Z","updated_at":"2015-02-15T20:17:24Z","pushed_at":"2015-05-25T17:28:37Z","git_url":"git://github.com/mr-archano/Playground.git","ssh_url":"git@github.com:mr-archano/Playground.git","clone_url":"https://github.com/mr-archano/Playground.git","svn_url":"https://github.com/mr-archano/Playground","homepage":null,"size":358,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/1"},"html":{"href":"https://github.com/mr-archano/Playground/pull/1"},"issue":{"href":"https://api.github.com/repos/mr-archano/Playground/issues/1"},"comments":{"href":"https://api.github.com/repos/mr-archano/Playground/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mr-archano/Playground/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mr-archano/Playground/statuses/0123d16424e36b2835991e3db74211bbc90c5a6b"}}}}