{"action":"created","comment":{"url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/comments/67606432","id":67606432,"diff_hunk":"@@ -0,0 +1,112 @@\n+<?php\n+namespace haymetric;\n+\n+/*\n+ * This file is part of the haymetric-sdk-php package.\n+ *\n+ * (c) Linh Dang <linh.danghong@gmail.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+use Monolog\\Handler\\StreamHandler;\n+use Monolog\\Logger;\n+\n+class HaymetricStreamHandler extends StreamHandler\n+{\n+    private $rotation;\n+    private $currentTimestamp = 0;\n+    private $mustRotate;\n+    private $nextRotation;\n+    private $filename;\n+\n+    public function __construct($filename, $rotation = Rotations::HOURLY, $filePermission = null, $useLocking = false, $timestamp = null)\n+    {\n+        $this->filename       = $filename;\n+        $this->filenameFormat = '{filename}.{date}';\n+        $this->dateFormat     = $this->dateFormat($rotation);\n+        $this->rotation       = $rotation;\n+        parent::__construct($this->getTimedFilename($timestamp), Logger::INFO, true, $filePermission, false);\n+\n+    }\n+\n+    public function dateFormat($rotation = Rotations::HOURLY)\n+    {\n+        switch ($rotation) {\n+            case Rotations::HOURLY:\n+                return \"Y-m-d-H\";\n+            case Rotations::MINUTELY:\n+                return \"Y-m-d-H-i\";\n+            case Rotations::DAILY:\n+                return \"Y-m-d\";\n+        }\n+    }\n+\n+    private function nextRotationTime($logEntryDateTime)\n+    {\n+        switch ($this->rotation) {\n+            case Rotations::HOURLY:\n+                return new \\DateTimeImmutable(\"@\" . floor(($logEntryDateTime->getTimeStamp() + 3600) / 3600) * 3600);\n+            case Rotations::MINUTELY:","path":"src/haymetric/HaymetricStreamHandler.php","position":50,"original_position":50,"commit_id":"0f1ae5c0feec4c8b2d6d143b38579173d5d046b7","original_commit_id":"0f1ae5c0feec4c8b2d6d143b38579173d5d046b7","user":{"login":"trungnq97","id":2920147,"avatar_url":"https://avatars.githubusercontent.com/u/2920147?v=3","gravatar_id":"","url":"https://api.github.com/users/trungnq97","html_url":"https://github.com/trungnq97","followers_url":"https://api.github.com/users/trungnq97/followers","following_url":"https://api.github.com/users/trungnq97/following{/other_user}","gists_url":"https://api.github.com/users/trungnq97/gists{/gist_id}","starred_url":"https://api.github.com/users/trungnq97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trungnq97/subscriptions","organizations_url":"https://api.github.com/users/trungnq97/orgs","repos_url":"https://api.github.com/users/trungnq97/repos","events_url":"https://api.github.com/users/trungnq97/events{/privacy}","received_events_url":"https://api.github.com/users/trungnq97/received_events","type":"User","site_admin":false},"body":"Same here.","created_at":"2016-06-18T20:49:08Z","updated_at":"2016-06-18T20:49:08Z","html_url":"https://github.com/haymetric/haymetric-sdk-php/pull/1#discussion_r67606432","pull_request_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/comments/67606432"},"html":{"href":"https://github.com/haymetric/haymetric-sdk-php/pull/1#discussion_r67606432"},"pull_request":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1","id":74345032,"html_url":"https://github.com/haymetric/haymetric-sdk-php/pull/1","diff_url":"https://github.com/haymetric/haymetric-sdk-php/pull/1.diff","patch_url":"https://github.com/haymetric/haymetric-sdk-php/pull/1.patch","issue_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/1","number":1,"state":"open","locked":false,"title":"Monolog integration","user":{"login":"linhdang","id":1724273,"avatar_url":"https://avatars.githubusercontent.com/u/1724273?v=3","gravatar_id":"","url":"https://api.github.com/users/linhdang","html_url":"https://github.com/linhdang","followers_url":"https://api.github.com/users/linhdang/followers","following_url":"https://api.github.com/users/linhdang/following{/other_user}","gists_url":"https://api.github.com/users/linhdang/gists{/gist_id}","starred_url":"https://api.github.com/users/linhdang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linhdang/subscriptions","organizations_url":"https://api.github.com/users/linhdang/orgs","repos_url":"https://api.github.com/users/linhdang/repos","events_url":"https://api.github.com/users/linhdang/events{/privacy}","received_events_url":"https://api.github.com/users/linhdang/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-18T19:13:15Z","updated_at":"2016-06-18T20:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b684c70e898b9e486b621f6ff80629e51ec42bd7","assignee":{"login":"trungnq97","id":2920147,"avatar_url":"https://avatars.githubusercontent.com/u/2920147?v=3","gravatar_id":"","url":"https://api.github.com/users/trungnq97","html_url":"https://github.com/trungnq97","followers_url":"https://api.github.com/users/trungnq97/followers","following_url":"https://api.github.com/users/trungnq97/following{/other_user}","gists_url":"https://api.github.com/users/trungnq97/gists{/gist_id}","starred_url":"https://api.github.com/users/trungnq97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trungnq97/subscriptions","organizations_url":"https://api.github.com/users/trungnq97/orgs","repos_url":"https://api.github.com/users/trungnq97/repos","events_url":"https://api.github.com/users/trungnq97/events{/privacy}","received_events_url":"https://api.github.com/users/trungnq97/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/milestones/1","html_url":"https://github.com/haymetric/haymetric-sdk-php/milestones/ready%20for%20","labels_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/milestones/1/labels","id":1836128,"number":1,"title":"ready for ","description":null,"creator":{"login":"linhdang","id":1724273,"avatar_url":"https://avatars.githubusercontent.com/u/1724273?v=3","gravatar_id":"","url":"https://api.github.com/users/linhdang","html_url":"https://github.com/linhdang","followers_url":"https://api.github.com/users/linhdang/followers","following_url":"https://api.github.com/users/linhdang/following{/other_user}","gists_url":"https://api.github.com/users/linhdang/gists{/gist_id}","starred_url":"https://api.github.com/users/linhdang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linhdang/subscriptions","organizations_url":"https://api.github.com/users/linhdang/orgs","repos_url":"https://api.github.com/users/linhdang/repos","events_url":"https://api.github.com/users/linhdang/events{/privacy}","received_events_url":"https://api.github.com/users/linhdang/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2016-06-18T19:20:34Z","updated_at":"2016-06-18T19:20:34Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1/commits","review_comments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1/comments","review_comment_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/comments{/number}","comments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/1/comments","statuses_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/statuses/0f1ae5c0feec4c8b2d6d143b38579173d5d046b7","head":{"label":"haymetric:monolog-integration","ref":"monolog-integration","sha":"0f1ae5c0feec4c8b2d6d143b38579173d5d046b7","user":{"login":"haymetric","id":19560059,"avatar_url":"https://avatars.githubusercontent.com/u/19560059?v=3","gravatar_id":"","url":"https://api.github.com/users/haymetric","html_url":"https://github.com/haymetric","followers_url":"https://api.github.com/users/haymetric/followers","following_url":"https://api.github.com/users/haymetric/following{/other_user}","gists_url":"https://api.github.com/users/haymetric/gists{/gist_id}","starred_url":"https://api.github.com/users/haymetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haymetric/subscriptions","organizations_url":"https://api.github.com/users/haymetric/orgs","repos_url":"https://api.github.com/users/haymetric/repos","events_url":"https://api.github.com/users/haymetric/events{/privacy}","received_events_url":"https://api.github.com/users/haymetric/received_events","type":"User","site_admin":false},"repo":{"id":59610145,"name":"haymetric-sdk-php","full_name":"haymetric/haymetric-sdk-php","owner":{"login":"haymetric","id":19560059,"avatar_url":"https://avatars.githubusercontent.com/u/19560059?v=3","gravatar_id":"","url":"https://api.github.com/users/haymetric","html_url":"https://github.com/haymetric","followers_url":"https://api.github.com/users/haymetric/followers","following_url":"https://api.github.com/users/haymetric/following{/other_user}","gists_url":"https://api.github.com/users/haymetric/gists{/gist_id}","starred_url":"https://api.github.com/users/haymetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haymetric/subscriptions","organizations_url":"https://api.github.com/users/haymetric/orgs","repos_url":"https://api.github.com/users/haymetric/repos","events_url":"https://api.github.com/users/haymetric/events{/privacy}","received_events_url":"https://api.github.com/users/haymetric/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haymetric/haymetric-sdk-php","description":"","fork":false,"url":"https://api.github.com/repos/haymetric/haymetric-sdk-php","forks_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/forks","keys_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/teams","hooks_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/hooks","issue_events_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/events{/number}","events_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/events","assignees_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/assignees{/user}","branches_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/branches{/branch}","tags_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/tags","blobs_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/statuses/{sha}","languages_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/languages","stargazers_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/stargazers","contributors_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/contributors","subscribers_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/subscribers","subscription_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/subscription","commits_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/contents/{+path}","compare_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/merges","archive_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/downloads","issues_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues{/number}","pulls_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls{/number}","milestones_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/milestones{/number}","notifications_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/labels{/name}","releases_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/releases{/id}","deployments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/deployments","created_at":"2016-05-24T21:32:57Z","updated_at":"2016-06-07T20:56:26Z","pushed_at":"2016-06-18T19:27:28Z","git_url":"git://github.com/haymetric/haymetric-sdk-php.git","ssh_url":"git@github.com:haymetric/haymetric-sdk-php.git","clone_url":"https://github.com/haymetric/haymetric-sdk-php.git","svn_url":"https://github.com/haymetric/haymetric-sdk-php","homepage":null,"size":25,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"haymetric:master","ref":"master","sha":"41ca9c63d3b01ceeb12e35f4e37a29edf532d5bd","user":{"login":"haymetric","id":19560059,"avatar_url":"https://avatars.githubusercontent.com/u/19560059?v=3","gravatar_id":"","url":"https://api.github.com/users/haymetric","html_url":"https://github.com/haymetric","followers_url":"https://api.github.com/users/haymetric/followers","following_url":"https://api.github.com/users/haymetric/following{/other_user}","gists_url":"https://api.github.com/users/haymetric/gists{/gist_id}","starred_url":"https://api.github.com/users/haymetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haymetric/subscriptions","organizations_url":"https://api.github.com/users/haymetric/orgs","repos_url":"https://api.github.com/users/haymetric/repos","events_url":"https://api.github.com/users/haymetric/events{/privacy}","received_events_url":"https://api.github.com/users/haymetric/received_events","type":"User","site_admin":false},"repo":{"id":59610145,"name":"haymetric-sdk-php","full_name":"haymetric/haymetric-sdk-php","owner":{"login":"haymetric","id":19560059,"avatar_url":"https://avatars.githubusercontent.com/u/19560059?v=3","gravatar_id":"","url":"https://api.github.com/users/haymetric","html_url":"https://github.com/haymetric","followers_url":"https://api.github.com/users/haymetric/followers","following_url":"https://api.github.com/users/haymetric/following{/other_user}","gists_url":"https://api.github.com/users/haymetric/gists{/gist_id}","starred_url":"https://api.github.com/users/haymetric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haymetric/subscriptions","organizations_url":"https://api.github.com/users/haymetric/orgs","repos_url":"https://api.github.com/users/haymetric/repos","events_url":"https://api.github.com/users/haymetric/events{/privacy}","received_events_url":"https://api.github.com/users/haymetric/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haymetric/haymetric-sdk-php","description":"","fork":false,"url":"https://api.github.com/repos/haymetric/haymetric-sdk-php","forks_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/forks","keys_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/teams","hooks_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/hooks","issue_events_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/events{/number}","events_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/events","assignees_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/assignees{/user}","branches_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/branches{/branch}","tags_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/tags","blobs_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/statuses/{sha}","languages_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/languages","stargazers_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/stargazers","contributors_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/contributors","subscribers_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/subscribers","subscription_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/subscription","commits_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/contents/{+path}","compare_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/merges","archive_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/downloads","issues_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues{/number}","pulls_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls{/number}","milestones_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/milestones{/number}","notifications_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/labels{/name}","releases_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/releases{/id}","deployments_url":"https://api.github.com/repos/haymetric/haymetric-sdk-php/deployments","created_at":"2016-05-24T21:32:57Z","updated_at":"2016-06-07T20:56:26Z","pushed_at":"2016-06-18T19:27:28Z","git_url":"git://github.com/haymetric/haymetric-sdk-php.git","ssh_url":"git@github.com:haymetric/haymetric-sdk-php.git","clone_url":"https://github.com/haymetric/haymetric-sdk-php.git","svn_url":"https://github.com/haymetric/haymetric-sdk-php","homepage":null,"size":25,"stargazers_count":0,"watchers_count":0,"language":"PHP","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/haymetric/haymetric-sdk-php/pulls/1"},"html":{"href":"https://github.com/haymetric/haymetric-sdk-php/pull/1"},"issue":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/1"},"comments":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/haymetric/haymetric-sdk-php/statuses/0f1ae5c0feec4c8b2d6d143b38579173d5d046b7"}}}}
{"actor":{"display_login":"trungnq97"}}