{"action":"created","comment":{"url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/comments/93642719","pull_request_review_id":14174276,"id":93642719,"diff_hunk":"@@ -524,6 +543,79 @@ public Object route(RoutingAction action, Object... args) throws RemoteException\n     }\n \n     /**\n+     * Stops the LogCat buffering.\n+     *\n+     * @param deviceSerialNumber\n+     *        - the serial number of the device\n+     */\n+    private void stopLogcat(String deviceSerialNumber) {\n+        logcatBuffer.remove(deviceSerialNumber);\n+    }\n+\n+    /**\n+     * Gets the newly added lines to the {@link LogcatBufer}.\n+     *\n+     * @param deviceSerialNumber\n+     *        - the serial number of the target device\n+     * @return a list of string lines\n+     */\n+    public List<Pair<Integer, String>> getNewOutputFromLogcatBuffer(String deviceSerialNumber) {\n+        return logcatBuffer.getBuffer(deviceSerialNumber);\n+    }\n+\n+    /**\n+     * Starts a LogCat for a specific device on the agent and add the output to the {@link Buffer}.\n+     *\n+     * @param deviceSerialNumber\n+     *        - the serial number of the target device\n+     * @param startLogcatCommand\n+     *        - an ADB for starting a LogCat.\n+     * @throws CommandFailedException\n+     *         thrown when fails to execute the command\n+     */\n+    private void startDeviceLogcat(String deviceSerialNumber, final String startLogcatCommand)\n+        throws CommandFailedException {\n+        logcatBuffer.addKey(deviceSerialNumber);\n+        LOGGER.info(\"Logcat buffering started.\");\n+\n+        Runtime runtime = Runtime.getRuntime();\n+        Process adbProcess = null;\n+        int controlLineId = 0;\n+        try {\n+            adbProcess = runtime.exec(startLogcatCommand);\n+            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(adbProcess.getInputStream()));\n+            String currentLine = null;\n+            while (logcatBuffer.contains(deviceSerialNumber)) {\n+                currentLine = bufferedReader.readLine();\n+                if (!currentLine.isEmpty()) {\n+                    Pair<Integer, String> idToLogLine = new Pair<Integer, String>(controlLineId, currentLine);\n+                    logcatBuffer.addValue(deviceSerialNumber, idToLogLine);\n+                    controlLineId++;\n+                }\n+            }\n+        } catch (IOException e) {\n+            throw new CommandFailedException();\n+        } finally {\n+            if (adbProcess != null) {\n+                adbProcess.destroy();\n+            }\n+            LOGGER.info(\"Logcat buffering finished.\");","path":"src/main/java/com/musala/atmosphere/agent/devicewrapper/AbstractWrapDevice.java","position":171,"original_position":141,"commit_id":"46a1eb78e4b7dc318db415b2b55be5dd8498ba92","original_commit_id":"46a1eb78e4b7dc318db415b2b55be5dd8498ba92","user":{"login":"YStankov","id":23720845,"avatar_url":"https://avatars.githubusercontent.com/u/23720845?v=3","gravatar_id":"","url":"https://api.github.com/users/YStankov","html_url":"https://github.com/YStankov","followers_url":"https://api.github.com/users/YStankov/followers","following_url":"https://api.github.com/users/YStankov/following{/other_user}","gists_url":"https://api.github.com/users/YStankov/gists{/gist_id}","starred_url":"https://api.github.com/users/YStankov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YStankov/subscriptions","organizations_url":"https://api.github.com/users/YStankov/orgs","repos_url":"https://api.github.com/users/YStankov/repos","events_url":"https://api.github.com/users/YStankov/events{/privacy}","received_events_url":"https://api.github.com/users/YStankov/received_events","type":"User","site_admin":false},"body":"You don't need to log here.","created_at":"2016-12-22T15:30:29Z","updated_at":"2016-12-22T15:37:07Z","html_url":"https://github.com/MusalaSoft/atmosphere-agent/pull/6#discussion_r93642719","pull_request_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/comments/93642719"},"html":{"href":"https://github.com/MusalaSoft/atmosphere-agent/pull/6#discussion_r93642719"},"pull_request":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6","id":98904667,"html_url":"https://github.com/MusalaSoft/atmosphere-agent/pull/6","diff_url":"https://github.com/MusalaSoft/atmosphere-agent/pull/6.diff","patch_url":"https://github.com/MusalaSoft/atmosphere-agent/pull/6.patch","issue_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/6","number":6,"state":"open","locked":false,"title":"Add a logcat buffer and commands","user":{"login":"dim4o","id":7069010,"avatar_url":"https://avatars.githubusercontent.com/u/7069010?v=3","gravatar_id":"","url":"https://api.github.com/users/dim4o","html_url":"https://github.com/dim4o","followers_url":"https://api.github.com/users/dim4o/followers","following_url":"https://api.github.com/users/dim4o/following{/other_user}","gists_url":"https://api.github.com/users/dim4o/gists{/gist_id}","starred_url":"https://api.github.com/users/dim4o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dim4o/subscriptions","organizations_url":"https://api.github.com/users/dim4o/orgs","repos_url":"https://api.github.com/users/dim4o/repos","events_url":"https://api.github.com/users/dim4o/events{/privacy}","received_events_url":"https://api.github.com/users/dim4o/received_events","type":"User","site_admin":false},"body":"Add a generic buffer that can be used from multiple clients simultaneously\r\nAdd commands for stop/start the logging and getting the new arrivals logs\r\nCreates the logcat files with unique names and deletes the logCat after being used","created_at":"2016-12-21T10:10:46Z","updated_at":"2016-12-22T15:37:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c912dfdecc3f79301b67e3976c2ef6992dcac15","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6/commits","review_comments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6/comments","review_comment_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/6/comments","statuses_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/statuses/46a1eb78e4b7dc318db415b2b55be5dd8498ba92","head":{"label":"MusalaSoft:logcat-console","ref":"logcat-console","sha":"46a1eb78e4b7dc318db415b2b55be5dd8498ba92","user":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars.githubusercontent.com/u/19668691?v=3","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"repo":{"id":62392946,"name":"atmosphere-agent","full_name":"MusalaSoft/atmosphere-agent","owner":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars.githubusercontent.com/u/19668691?v=3","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MusalaSoft/atmosphere-agent","description":null,"fork":false,"url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent","forks_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/forks","keys_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/teams","hooks_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/hooks","issue_events_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/events{/number}","events_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/events","assignees_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/assignees{/user}","branches_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/branches{/branch}","tags_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/tags","blobs_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/languages","stargazers_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/stargazers","contributors_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/contributors","subscribers_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/subscribers","subscription_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/subscription","commits_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/contents/{+path}","compare_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/merges","archive_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/downloads","issues_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues{/number}","pulls_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/labels{/name}","releases_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/releases{/id}","deployments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/deployments","created_at":"2016-07-01T12:54:41Z","updated_at":"2016-10-27T13:17:07Z","pushed_at":"2016-12-22T15:00:34Z","git_url":"git://github.com/MusalaSoft/atmosphere-agent.git","ssh_url":"git@github.com:MusalaSoft/atmosphere-agent.git","clone_url":"https://github.com/MusalaSoft/atmosphere-agent.git","svn_url":"https://github.com/MusalaSoft/atmosphere-agent","homepage":null,"size":54350,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"MusalaSoft:dev","ref":"dev","sha":"6bae388cf7b758d75ab4a9710c88e041644a4d26","user":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars.githubusercontent.com/u/19668691?v=3","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"repo":{"id":62392946,"name":"atmosphere-agent","full_name":"MusalaSoft/atmosphere-agent","owner":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars.githubusercontent.com/u/19668691?v=3","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MusalaSoft/atmosphere-agent","description":null,"fork":false,"url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent","forks_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/forks","keys_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/teams","hooks_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/hooks","issue_events_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/events{/number}","events_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/events","assignees_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/assignees{/user}","branches_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/branches{/branch}","tags_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/tags","blobs_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/languages","stargazers_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/stargazers","contributors_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/contributors","subscribers_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/subscribers","subscription_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/subscription","commits_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/contents/{+path}","compare_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/merges","archive_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/downloads","issues_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues{/number}","pulls_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/labels{/name}","releases_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/releases{/id}","deployments_url":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/deployments","created_at":"2016-07-01T12:54:41Z","updated_at":"2016-10-27T13:17:07Z","pushed_at":"2016-12-22T15:00:34Z","git_url":"git://github.com/MusalaSoft/atmosphere-agent.git","ssh_url":"git@github.com:MusalaSoft/atmosphere-agent.git","clone_url":"https://github.com/MusalaSoft/atmosphere-agent.git","svn_url":"https://github.com/MusalaSoft/atmosphere-agent","homepage":null,"size":54350,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6"},"html":{"href":"https://github.com/MusalaSoft/atmosphere-agent/pull/6"},"issue":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/6"},"comments":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/MusalaSoft/atmosphere-agent/statuses/46a1eb78e4b7dc318db415b2b55be5dd8498ba92"}}}}
{"actor":{"display_login":"YStankov"}}