{"action":"created","comment":{"url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/comments/61126846","id":61126846,"diff_hunk":"@@ -4,30 +4,83 @@\n \n use Monolog\\Logger;\n use Monolog\\Handler\\RedisHandler;\n+use Monolog\\Handler\\StreamHandler;\n use Monolog\\Formatter\\LogstashFormatter;\n+use MessageQueuePHP\\Message\\Message;\n+use MessageQueuePHP\\Adapter\\AdapterInterface;\n+use MessageQueuePHP\\Config\\ConfigInterface;\n use Predis\\Client as RedisClient;\n \n-class QueueLogger\n+class QueueLogger implements AdapterInterface\n {\n-\tprivate $logger;\n+    /**\n+     * @var [Monolog\\Logger]\n+     */\n+    private $logger;\n \n-\tpublic function __construct($channel, $key, $host, $port)\n-\t{\n-\t\t$redisClient = new RedisClient([\n+    /**\n+     * @param string $channel\n+     * @param string $key\n+     * @param string $host\n+     * @param string $port\n+     */\n+    public function __construct(ConfigInterface $config)\n+    {\n+        $configLogger = $config->getConfig();\n+\n+        $host    = $configLogger['logger']['host'];\n+        $port    = $configLogger['logger']['port'];\n+        $key     = $configLogger['logger']['key'];\n+        $channel = $configLogger['logger']['channel'];\n+        $path    = $configLogger['logger']['path'];\n+\n+        $redisClient  = new RedisClient([\n                     'scheme' => 'tcp',\n                     'host'   => $host,\n                     'port'   => $port\n                 ]);\n \n-\t\t$redisHandler = new RedisHandler($redisClient, $key);\n-\t\t$formatter    = new LogstashFormatter($channel);\n-\t\t$redisHandler->setFormatter($formatter);\n+        try {\n+            $redisClient->ping();\n+            $handler   = new RedisHandler($redisClient, $key);\n+            $formatter = new LogstashFormatter($channel);\n+            $handler->setFormatter($formatter);\n+        }catch (Exception $e) {","path":"src/Logger/QueueLogger.php","position":53,"original_position":53,"commit_id":"813f10140b9e8f937452746f2d85c529be88ab98","original_commit_id":"813f10140b9e8f937452746f2d85c529be88ab98","user":{"login":"fdiasdev","id":2362967,"avatar_url":"https://avatars.githubusercontent.com/u/2362967?v=3","gravatar_id":"","url":"https://api.github.com/users/fdiasdev","html_url":"https://github.com/fdiasdev","followers_url":"https://api.github.com/users/fdiasdev/followers","following_url":"https://api.github.com/users/fdiasdev/following{/other_user}","gists_url":"https://api.github.com/users/fdiasdev/gists{/gist_id}","starred_url":"https://api.github.com/users/fdiasdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdiasdev/subscriptions","organizations_url":"https://api.github.com/users/fdiasdev/orgs","repos_url":"https://api.github.com/users/fdiasdev/repos","events_url":"https://api.github.com/users/fdiasdev/events{/privacy}","received_events_url":"https://api.github.com/users/fdiasdev/received_events","type":"User","site_admin":false},"body":"    } catch (Exception $e) {","created_at":"2016-04-26T17:21:31Z","updated_at":"2016-04-26T17:21:31Z","html_url":"https://github.com/ingresse/message-queue-php/pull/6#discussion_r61126846","pull_request_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/ingresse/message-queue-php/pulls/comments/61126846"},"html":{"href":"https://github.com/ingresse/message-queue-php/pull/6#discussion_r61126846"},"pull_request":{"href":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6","id":67920823,"html_url":"https://github.com/ingresse/message-queue-php/pull/6","diff_url":"https://github.com/ingresse/message-queue-php/pull/6.diff","patch_url":"https://github.com/ingresse/message-queue-php/pull/6.patch","issue_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/6","number":6,"state":"open","locked":false,"title":"Logger Adapter","user":{"login":"Taffarel","id":487235,"avatar_url":"https://avatars.githubusercontent.com/u/487235?v=3","gravatar_id":"","url":"https://api.github.com/users/Taffarel","html_url":"https://github.com/Taffarel","followers_url":"https://api.github.com/users/Taffarel/followers","following_url":"https://api.github.com/users/Taffarel/following{/other_user}","gists_url":"https://api.github.com/users/Taffarel/gists{/gist_id}","starred_url":"https://api.github.com/users/Taffarel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taffarel/subscriptions","organizations_url":"https://api.github.com/users/Taffarel/orgs","repos_url":"https://api.github.com/users/Taffarel/repos","events_url":"https://api.github.com/users/Taffarel/events{/privacy}","received_events_url":"https://api.github.com/users/Taffarel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-26T16:54:28Z","updated_at":"2016-04-26T17:21:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd7dd153d6dcbbd9f51353849baa61b48f856f3b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6/commits","review_comments_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6/comments","review_comment_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/6/comments","statuses_url":"https://api.github.com/repos/ingresse/message-queue-php/statuses/813f10140b9e8f937452746f2d85c529be88ab98","head":{"label":"ingresse:feature/logger-adapter","ref":"feature/logger-adapter","sha":"813f10140b9e8f937452746f2d85c529be88ab98","user":{"login":"ingresse","id":1704650,"avatar_url":"https://avatars.githubusercontent.com/u/1704650?v=3","gravatar_id":"","url":"https://api.github.com/users/ingresse","html_url":"https://github.com/ingresse","followers_url":"https://api.github.com/users/ingresse/followers","following_url":"https://api.github.com/users/ingresse/following{/other_user}","gists_url":"https://api.github.com/users/ingresse/gists{/gist_id}","starred_url":"https://api.github.com/users/ingresse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ingresse/subscriptions","organizations_url":"https://api.github.com/users/ingresse/orgs","repos_url":"https://api.github.com/users/ingresse/repos","events_url":"https://api.github.com/users/ingresse/events{/privacy}","received_events_url":"https://api.github.com/users/ingresse/received_events","type":"Organization","site_admin":false},"repo":{"id":53357945,"name":"message-queue-php","full_name":"ingresse/message-queue-php","owner":{"login":"ingresse","id":1704650,"avatar_url":"https://avatars.githubusercontent.com/u/1704650?v=3","gravatar_id":"","url":"https://api.github.com/users/ingresse","html_url":"https://github.com/ingresse","followers_url":"https://api.github.com/users/ingresse/followers","following_url":"https://api.github.com/users/ingresse/following{/other_user}","gists_url":"https://api.github.com/users/ingresse/gists{/gist_id}","starred_url":"https://api.github.com/users/ingresse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ingresse/subscriptions","organizations_url":"https://api.github.com/users/ingresse/orgs","repos_url":"https://api.github.com/users/ingresse/repos","events_url":"https://api.github.com/users/ingresse/events{/privacy}","received_events_url":"https://api.github.com/users/ingresse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ingresse/message-queue-php","description":"PHP Message Queue","fork":false,"url":"https://api.github.com/repos/ingresse/message-queue-php","forks_url":"https://api.github.com/repos/ingresse/message-queue-php/forks","keys_url":"https://api.github.com/repos/ingresse/message-queue-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ingresse/message-queue-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ingresse/message-queue-php/teams","hooks_url":"https://api.github.com/repos/ingresse/message-queue-php/hooks","issue_events_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/events{/number}","events_url":"https://api.github.com/repos/ingresse/message-queue-php/events","assignees_url":"https://api.github.com/repos/ingresse/message-queue-php/assignees{/user}","branches_url":"https://api.github.com/repos/ingresse/message-queue-php/branches{/branch}","tags_url":"https://api.github.com/repos/ingresse/message-queue-php/tags","blobs_url":"https://api.github.com/repos/ingresse/message-queue-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ingresse/message-queue-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ingresse/message-queue-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/ingresse/message-queue-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ingresse/message-queue-php/statuses/{sha}","languages_url":"https://api.github.com/repos/ingresse/message-queue-php/languages","stargazers_url":"https://api.github.com/repos/ingresse/message-queue-php/stargazers","contributors_url":"https://api.github.com/repos/ingresse/message-queue-php/contributors","subscribers_url":"https://api.github.com/repos/ingresse/message-queue-php/subscribers","subscription_url":"https://api.github.com/repos/ingresse/message-queue-php/subscription","commits_url":"https://api.github.com/repos/ingresse/message-queue-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/ingresse/message-queue-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/ingresse/message-queue-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/ingresse/message-queue-php/contents/{+path}","compare_url":"https://api.github.com/repos/ingresse/message-queue-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ingresse/message-queue-php/merges","archive_url":"https://api.github.com/repos/ingresse/message-queue-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ingresse/message-queue-php/downloads","issues_url":"https://api.github.com/repos/ingresse/message-queue-php/issues{/number}","pulls_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls{/number}","milestones_url":"https://api.github.com/repos/ingresse/message-queue-php/milestones{/number}","notifications_url":"https://api.github.com/repos/ingresse/message-queue-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ingresse/message-queue-php/labels{/name}","releases_url":"https://api.github.com/repos/ingresse/message-queue-php/releases{/id}","deployments_url":"https://api.github.com/repos/ingresse/message-queue-php/deployments","created_at":"2016-03-07T20:48:03Z","updated_at":"2016-03-24T18:00:45Z","pushed_at":"2016-04-26T16:54:29Z","git_url":"git://github.com/ingresse/message-queue-php.git","ssh_url":"git@github.com:ingresse/message-queue-php.git","clone_url":"https://github.com/ingresse/message-queue-php.git","svn_url":"https://github.com/ingresse/message-queue-php","homepage":"","size":26,"stargazers_count":1,"watchers_count":1,"language":"PHP","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":"ingresse:master","ref":"master","sha":"d82bbf27043c0859364cd4481ecc4f0b330f99ae","user":{"login":"ingresse","id":1704650,"avatar_url":"https://avatars.githubusercontent.com/u/1704650?v=3","gravatar_id":"","url":"https://api.github.com/users/ingresse","html_url":"https://github.com/ingresse","followers_url":"https://api.github.com/users/ingresse/followers","following_url":"https://api.github.com/users/ingresse/following{/other_user}","gists_url":"https://api.github.com/users/ingresse/gists{/gist_id}","starred_url":"https://api.github.com/users/ingresse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ingresse/subscriptions","organizations_url":"https://api.github.com/users/ingresse/orgs","repos_url":"https://api.github.com/users/ingresse/repos","events_url":"https://api.github.com/users/ingresse/events{/privacy}","received_events_url":"https://api.github.com/users/ingresse/received_events","type":"Organization","site_admin":false},"repo":{"id":53357945,"name":"message-queue-php","full_name":"ingresse/message-queue-php","owner":{"login":"ingresse","id":1704650,"avatar_url":"https://avatars.githubusercontent.com/u/1704650?v=3","gravatar_id":"","url":"https://api.github.com/users/ingresse","html_url":"https://github.com/ingresse","followers_url":"https://api.github.com/users/ingresse/followers","following_url":"https://api.github.com/users/ingresse/following{/other_user}","gists_url":"https://api.github.com/users/ingresse/gists{/gist_id}","starred_url":"https://api.github.com/users/ingresse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ingresse/subscriptions","organizations_url":"https://api.github.com/users/ingresse/orgs","repos_url":"https://api.github.com/users/ingresse/repos","events_url":"https://api.github.com/users/ingresse/events{/privacy}","received_events_url":"https://api.github.com/users/ingresse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ingresse/message-queue-php","description":"PHP Message Queue","fork":false,"url":"https://api.github.com/repos/ingresse/message-queue-php","forks_url":"https://api.github.com/repos/ingresse/message-queue-php/forks","keys_url":"https://api.github.com/repos/ingresse/message-queue-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ingresse/message-queue-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ingresse/message-queue-php/teams","hooks_url":"https://api.github.com/repos/ingresse/message-queue-php/hooks","issue_events_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/events{/number}","events_url":"https://api.github.com/repos/ingresse/message-queue-php/events","assignees_url":"https://api.github.com/repos/ingresse/message-queue-php/assignees{/user}","branches_url":"https://api.github.com/repos/ingresse/message-queue-php/branches{/branch}","tags_url":"https://api.github.com/repos/ingresse/message-queue-php/tags","blobs_url":"https://api.github.com/repos/ingresse/message-queue-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ingresse/message-queue-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ingresse/message-queue-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/ingresse/message-queue-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ingresse/message-queue-php/statuses/{sha}","languages_url":"https://api.github.com/repos/ingresse/message-queue-php/languages","stargazers_url":"https://api.github.com/repos/ingresse/message-queue-php/stargazers","contributors_url":"https://api.github.com/repos/ingresse/message-queue-php/contributors","subscribers_url":"https://api.github.com/repos/ingresse/message-queue-php/subscribers","subscription_url":"https://api.github.com/repos/ingresse/message-queue-php/subscription","commits_url":"https://api.github.com/repos/ingresse/message-queue-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/ingresse/message-queue-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/ingresse/message-queue-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/ingresse/message-queue-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/ingresse/message-queue-php/contents/{+path}","compare_url":"https://api.github.com/repos/ingresse/message-queue-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ingresse/message-queue-php/merges","archive_url":"https://api.github.com/repos/ingresse/message-queue-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ingresse/message-queue-php/downloads","issues_url":"https://api.github.com/repos/ingresse/message-queue-php/issues{/number}","pulls_url":"https://api.github.com/repos/ingresse/message-queue-php/pulls{/number}","milestones_url":"https://api.github.com/repos/ingresse/message-queue-php/milestones{/number}","notifications_url":"https://api.github.com/repos/ingresse/message-queue-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ingresse/message-queue-php/labels{/name}","releases_url":"https://api.github.com/repos/ingresse/message-queue-php/releases{/id}","deployments_url":"https://api.github.com/repos/ingresse/message-queue-php/deployments","created_at":"2016-03-07T20:48:03Z","updated_at":"2016-03-24T18:00:45Z","pushed_at":"2016-04-26T16:54:29Z","git_url":"git://github.com/ingresse/message-queue-php.git","ssh_url":"git@github.com:ingresse/message-queue-php.git","clone_url":"https://github.com/ingresse/message-queue-php.git","svn_url":"https://github.com/ingresse/message-queue-php","homepage":"","size":26,"stargazers_count":1,"watchers_count":1,"language":"PHP","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/ingresse/message-queue-php/pulls/6"},"html":{"href":"https://github.com/ingresse/message-queue-php/pull/6"},"issue":{"href":"https://api.github.com/repos/ingresse/message-queue-php/issues/6"},"comments":{"href":"https://api.github.com/repos/ingresse/message-queue-php/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/ingresse/message-queue-php/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ingresse/message-queue-php/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/ingresse/message-queue-php/statuses/813f10140b9e8f937452746f2d85c529be88ab98"}}}}