{"action":"created","comment":{"url":"https://api.github.com/repos/phlib/logger/pulls/comments/61555716","id":61555716,"diff_hunk":"@@ -0,0 +1,75 @@\n+<?php\n+\n+namespace Phlib\\Logger;\n+\n+use Symfony\\Component\\Console\\Formatter\\OutputFormatter;\n+use Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle;\n+\n+/**\n+ * Class CliColor\n+ *\n+ * Write to CLI with colour!\n+ *\n+ * @package Phlib\\Logger\n+ */\n+class CliColor extends Stream\n+{\n+    /**\n+     * @var string\n+     */\n+    private $currentLevel;\n+\n+    /**\n+     * @var OutputFormatter\n+     */\n+    private $formatter;\n+\n+    /**\n+     * @see Stream::__construct()\n+     * @param string $name\n+     * @param resource|string $stream Optional. Default to Standard Error\n+     */\n+    public function __construct($name, $stream = STDERR)\n+    {\n+        parent::__construct($name, $stream);\n+\n+        $this->formatter = new OutputFormatter(true, [\n+            'debug'     => new OutputFormatterStyle(),\n+            'info'      => new OutputFormatterStyle('blue'),\n+            'notice'    => new OutputFormatterStyle('green'),\n+            'warning'   => new OutputFormatterStyle('yellow'),\n+            'error'     => new OutputFormatterStyle('red'),\n+            'critical'  => new OutputFormatterStyle('red', 'yellow'),\n+            'alert'     => new OutputFormatterStyle('white', 'red', ['bold']),\n+            'emergency' => new OutputFormatterStyle('white', 'red', ['bold', 'underscore'])\n+        ]);\n+    }\n+\n+    /**\n+     * Logs with an arbitrary level.\n+     *\n+     * @see Stream::log()\n+     * @param mixed $level\n+     * @param string $message\n+     * @param array $context\n+     * @return void\n+     */\n+    public function log($level, $message, array $context = array())\n+    {\n+        $this->currentLevel = $level;","path":"src/CliColor.php","position":59,"original_position":59,"commit_id":"a69baac5f9cf321c62e907941d68f58d72cb69ec","original_commit_id":"a69baac5f9cf321c62e907941d68f58d72cb69ec","user":{"login":"Pudge601","id":2520380,"avatar_url":"https://avatars.githubusercontent.com/u/2520380?v=3","gravatar_id":"","url":"https://api.github.com/users/Pudge601","html_url":"https://github.com/Pudge601","followers_url":"https://api.github.com/users/Pudge601/followers","following_url":"https://api.github.com/users/Pudge601/following{/other_user}","gists_url":"https://api.github.com/users/Pudge601/gists{/gist_id}","starred_url":"https://api.github.com/users/Pudge601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pudge601/subscriptions","organizations_url":"https://api.github.com/users/Pudge601/orgs","repos_url":"https://api.github.com/users/Pudge601/repos","events_url":"https://api.github.com/users/Pudge601/events{/privacy}","received_events_url":"https://api.github.com/users/Pudge601/received_events","type":"User","site_admin":false},"body":"Yeah, I guess so, not sure that datetime/name/message would ever be likely to be used to affect the message format, and not sure about passing the generic sounding 'meta' array..\r\n\r\nThe advantage of passing the individual arguments for level and context is that it's obvious from just the method signature what the method can work with, but that's not as big a deal if the method is clearly documented like you've done.\r\n\r\nSo I guess I don't mind either way really.","created_at":"2016-04-29T09:53:55Z","updated_at":"2016-04-29T09:53:55Z","html_url":"https://github.com/phlib/logger/pull/7#discussion_r61555716","pull_request_url":"https://api.github.com/repos/phlib/logger/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/phlib/logger/pulls/comments/61555716"},"html":{"href":"https://github.com/phlib/logger/pull/7#discussion_r61555716"},"pull_request":{"href":"https://api.github.com/repos/phlib/logger/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/phlib/logger/pulls/7","id":68245585,"html_url":"https://github.com/phlib/logger/pull/7","diff_url":"https://github.com/phlib/logger/pull/7.diff","patch_url":"https://github.com/phlib/logger/pull/7.patch","issue_url":"https://api.github.com/repos/phlib/logger/issues/7","number":7,"state":"open","locked":false,"title":"Add CLI logger with colours","user":{"login":"chrisminett","id":1084019,"avatar_url":"https://avatars.githubusercontent.com/u/1084019?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisminett","html_url":"https://github.com/chrisminett","followers_url":"https://api.github.com/users/chrisminett/followers","following_url":"https://api.github.com/users/chrisminett/following{/other_user}","gists_url":"https://api.github.com/users/chrisminett/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisminett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisminett/subscriptions","organizations_url":"https://api.github.com/users/chrisminett/orgs","repos_url":"https://api.github.com/users/chrisminett/repos","events_url":"https://api.github.com/users/chrisminett/events{/privacy}","received_events_url":"https://api.github.com/users/chrisminett/received_events","type":"User","site_admin":false},"body":"Extend Stream logger to add a CLI-specific logger which adds level-based colours.\r\n\r\nUses Symfony Console to deal with the colours. v2.5 branch is included to provide BC to php54, otherwise v3 is preferred. The two classes we're using do not functionally change between these versions.","created_at":"2016-04-28T15:56:09Z","updated_at":"2016-04-29T09:53:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53b569c9683f603be3145d15e2cc193656dc0dc3","assignee":{"login":"Pudge601","id":2520380,"avatar_url":"https://avatars.githubusercontent.com/u/2520380?v=3","gravatar_id":"","url":"https://api.github.com/users/Pudge601","html_url":"https://github.com/Pudge601","followers_url":"https://api.github.com/users/Pudge601/followers","following_url":"https://api.github.com/users/Pudge601/following{/other_user}","gists_url":"https://api.github.com/users/Pudge601/gists{/gist_id}","starred_url":"https://api.github.com/users/Pudge601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pudge601/subscriptions","organizations_url":"https://api.github.com/users/Pudge601/orgs","repos_url":"https://api.github.com/users/Pudge601/repos","events_url":"https://api.github.com/users/Pudge601/events{/privacy}","received_events_url":"https://api.github.com/users/Pudge601/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/phlib/logger/pulls/7/commits","review_comments_url":"https://api.github.com/repos/phlib/logger/pulls/7/comments","review_comment_url":"https://api.github.com/repos/phlib/logger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phlib/logger/issues/7/comments","statuses_url":"https://api.github.com/repos/phlib/logger/statuses/a69baac5f9cf321c62e907941d68f58d72cb69ec","head":{"label":"phlib:feature/cli-color","ref":"feature/cli-color","sha":"a69baac5f9cf321c62e907941d68f58d72cb69ec","user":{"login":"phlib","id":8135844,"avatar_url":"https://avatars.githubusercontent.com/u/8135844?v=3","gravatar_id":"","url":"https://api.github.com/users/phlib","html_url":"https://github.com/phlib","followers_url":"https://api.github.com/users/phlib/followers","following_url":"https://api.github.com/users/phlib/following{/other_user}","gists_url":"https://api.github.com/users/phlib/gists{/gist_id}","starred_url":"https://api.github.com/users/phlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlib/subscriptions","organizations_url":"https://api.github.com/users/phlib/orgs","repos_url":"https://api.github.com/users/phlib/repos","events_url":"https://api.github.com/users/phlib/events{/privacy}","received_events_url":"https://api.github.com/users/phlib/received_events","type":"Organization","site_admin":false},"repo":{"id":40490859,"name":"logger","full_name":"phlib/logger","owner":{"login":"phlib","id":8135844,"avatar_url":"https://avatars.githubusercontent.com/u/8135844?v=3","gravatar_id":"","url":"https://api.github.com/users/phlib","html_url":"https://github.com/phlib","followers_url":"https://api.github.com/users/phlib/followers","following_url":"https://api.github.com/users/phlib/following{/other_user}","gists_url":"https://api.github.com/users/phlib/gists{/gist_id}","starred_url":"https://api.github.com/users/phlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlib/subscriptions","organizations_url":"https://api.github.com/users/phlib/orgs","repos_url":"https://api.github.com/users/phlib/repos","events_url":"https://api.github.com/users/phlib/events{/privacy}","received_events_url":"https://api.github.com/users/phlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phlib/logger","description":"PHP PSR-3-compatible logger","fork":false,"url":"https://api.github.com/repos/phlib/logger","forks_url":"https://api.github.com/repos/phlib/logger/forks","keys_url":"https://api.github.com/repos/phlib/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phlib/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phlib/logger/teams","hooks_url":"https://api.github.com/repos/phlib/logger/hooks","issue_events_url":"https://api.github.com/repos/phlib/logger/issues/events{/number}","events_url":"https://api.github.com/repos/phlib/logger/events","assignees_url":"https://api.github.com/repos/phlib/logger/assignees{/user}","branches_url":"https://api.github.com/repos/phlib/logger/branches{/branch}","tags_url":"https://api.github.com/repos/phlib/logger/tags","blobs_url":"https://api.github.com/repos/phlib/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phlib/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phlib/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/phlib/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phlib/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/phlib/logger/languages","stargazers_url":"https://api.github.com/repos/phlib/logger/stargazers","contributors_url":"https://api.github.com/repos/phlib/logger/contributors","subscribers_url":"https://api.github.com/repos/phlib/logger/subscribers","subscription_url":"https://api.github.com/repos/phlib/logger/subscription","commits_url":"https://api.github.com/repos/phlib/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/phlib/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/phlib/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/phlib/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/phlib/logger/contents/{+path}","compare_url":"https://api.github.com/repos/phlib/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phlib/logger/merges","archive_url":"https://api.github.com/repos/phlib/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phlib/logger/downloads","issues_url":"https://api.github.com/repos/phlib/logger/issues{/number}","pulls_url":"https://api.github.com/repos/phlib/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/phlib/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/phlib/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phlib/logger/labels{/name}","releases_url":"https://api.github.com/repos/phlib/logger/releases{/id}","deployments_url":"https://api.github.com/repos/phlib/logger/deployments","created_at":"2015-08-10T15:42:59Z","updated_at":"2016-03-21T12:23:35Z","pushed_at":"2016-04-28T15:56:09Z","git_url":"git://github.com/phlib/logger.git","ssh_url":"git@github.com:phlib/logger.git","clone_url":"https://github.com/phlib/logger.git","svn_url":"https://github.com/phlib/logger","homepage":"","size":36,"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":"phlib:master","ref":"master","sha":"a839d7428074936f89d27be4e367c79d3b5a05f8","user":{"login":"phlib","id":8135844,"avatar_url":"https://avatars.githubusercontent.com/u/8135844?v=3","gravatar_id":"","url":"https://api.github.com/users/phlib","html_url":"https://github.com/phlib","followers_url":"https://api.github.com/users/phlib/followers","following_url":"https://api.github.com/users/phlib/following{/other_user}","gists_url":"https://api.github.com/users/phlib/gists{/gist_id}","starred_url":"https://api.github.com/users/phlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlib/subscriptions","organizations_url":"https://api.github.com/users/phlib/orgs","repos_url":"https://api.github.com/users/phlib/repos","events_url":"https://api.github.com/users/phlib/events{/privacy}","received_events_url":"https://api.github.com/users/phlib/received_events","type":"Organization","site_admin":false},"repo":{"id":40490859,"name":"logger","full_name":"phlib/logger","owner":{"login":"phlib","id":8135844,"avatar_url":"https://avatars.githubusercontent.com/u/8135844?v=3","gravatar_id":"","url":"https://api.github.com/users/phlib","html_url":"https://github.com/phlib","followers_url":"https://api.github.com/users/phlib/followers","following_url":"https://api.github.com/users/phlib/following{/other_user}","gists_url":"https://api.github.com/users/phlib/gists{/gist_id}","starred_url":"https://api.github.com/users/phlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlib/subscriptions","organizations_url":"https://api.github.com/users/phlib/orgs","repos_url":"https://api.github.com/users/phlib/repos","events_url":"https://api.github.com/users/phlib/events{/privacy}","received_events_url":"https://api.github.com/users/phlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phlib/logger","description":"PHP PSR-3-compatible logger","fork":false,"url":"https://api.github.com/repos/phlib/logger","forks_url":"https://api.github.com/repos/phlib/logger/forks","keys_url":"https://api.github.com/repos/phlib/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phlib/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phlib/logger/teams","hooks_url":"https://api.github.com/repos/phlib/logger/hooks","issue_events_url":"https://api.github.com/repos/phlib/logger/issues/events{/number}","events_url":"https://api.github.com/repos/phlib/logger/events","assignees_url":"https://api.github.com/repos/phlib/logger/assignees{/user}","branches_url":"https://api.github.com/repos/phlib/logger/branches{/branch}","tags_url":"https://api.github.com/repos/phlib/logger/tags","blobs_url":"https://api.github.com/repos/phlib/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phlib/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phlib/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/phlib/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phlib/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/phlib/logger/languages","stargazers_url":"https://api.github.com/repos/phlib/logger/stargazers","contributors_url":"https://api.github.com/repos/phlib/logger/contributors","subscribers_url":"https://api.github.com/repos/phlib/logger/subscribers","subscription_url":"https://api.github.com/repos/phlib/logger/subscription","commits_url":"https://api.github.com/repos/phlib/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/phlib/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/phlib/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/phlib/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/phlib/logger/contents/{+path}","compare_url":"https://api.github.com/repos/phlib/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phlib/logger/merges","archive_url":"https://api.github.com/repos/phlib/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phlib/logger/downloads","issues_url":"https://api.github.com/repos/phlib/logger/issues{/number}","pulls_url":"https://api.github.com/repos/phlib/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/phlib/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/phlib/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phlib/logger/labels{/name}","releases_url":"https://api.github.com/repos/phlib/logger/releases{/id}","deployments_url":"https://api.github.com/repos/phlib/logger/deployments","created_at":"2015-08-10T15:42:59Z","updated_at":"2016-03-21T12:23:35Z","pushed_at":"2016-04-28T15:56:09Z","git_url":"git://github.com/phlib/logger.git","ssh_url":"git@github.com:phlib/logger.git","clone_url":"https://github.com/phlib/logger.git","svn_url":"https://github.com/phlib/logger","homepage":"","size":36,"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/phlib/logger/pulls/7"},"html":{"href":"https://github.com/phlib/logger/pull/7"},"issue":{"href":"https://api.github.com/repos/phlib/logger/issues/7"},"comments":{"href":"https://api.github.com/repos/phlib/logger/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/phlib/logger/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/phlib/logger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phlib/logger/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/phlib/logger/statuses/a69baac5f9cf321c62e907941d68f58d72cb69ec"}}}}