{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/141058629","pull_request_review_id":65217405,"id":141058629,"diff_hunk":"@@ -0,0 +1,99 @@\n+<?php\n+\n+/*\n+ * This file is part of the Symfony package.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.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+\n+namespace Symfony\\Bundle\\FrameworkBundle\\Logger;\n+\n+use Psr\\Log\\AbstractLogger;\n+use Psr\\Log\\InvalidArgumentException;\n+use Psr\\Log\\LogLevel;\n+\n+/**\n+ * Minimalist PSR-3 logger designed to write in stderr or any other stream.\n+ *\n+ * @internal\n+ *\n+ * @author Kévin Dunglas <dunglas@gmail.com>\n+ */\n+final class Logger extends AbstractLogger\n+{\n+    private static $levels = array(\n+        LogLevel::DEBUG => 0,\n+        LogLevel::INFO => 1,\n+        LogLevel::NOTICE => 2,\n+        LogLevel::WARNING => 3,\n+        LogLevel::ERROR => 4,\n+        LogLevel::CRITICAL => 5,\n+        LogLevel::ALERT => 6,\n+        LogLevel::EMERGENCY => 7,\n+    );\n+\n+    private $minLevelIndex;\n+    private $formatter;\n+    private $handle;\n+\n+    public function __construct($minLevel = LogLevel::WARNING, $output = 'php://stderr', callable $formatter = null)\n+    {\n+        if (!isset(self::$levels[$minLevel])) {\n+            throw new InvalidArgumentException(sprintf('The log level \"%s\" does not exist.', $minLevel));\n+        }\n+\n+        $this->minLevelIndex = self::$levels[$minLevel];\n+        $this->formatter = $formatter ?: array($this, 'format');\n+        if (false === $this->handle = @fopen($output, 'a')) {\n+            throw new InvalidArgumentException(sprintf('Unable to open \"%s\".', $output));\n+        }\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function log($level, $message, array $context = array())\n+    {\n+        if (!isset(self::$levels[$level])) {\n+            throw new InvalidArgumentException(sprintf('The log level \"%s\" does not exist.', $level));\n+        }\n+\n+        if (self::$levels[$level] < $this->minLevelIndex) {\n+            return;\n+        }\n+\n+        $formatter = $this->formatter;\n+        fwrite($this->handle, $formatter($level, $message, $context));\n+    }\n+\n+    /**\n+     * @param string $level\n+     * @param string $message\n+     *\n+     * @return string\n+     */\n+    private function format($level, $message, array $context)\n+    {\n+        if (false !== strpos($message, '{')) {\n+            $replacements = array();\n+            foreach ($context as $key => $val) {\n+                if (null === $val || is_scalar($val) || (\\is_object($val) && method_exists($val, '__toString'))) {\n+                    $replacements[\"{{$key}}\"] = $val;\n+                } elseif ($val instanceof \\DateTimeInterface) {\n+                    $replacements[\"{{$key}}\"] = $val->format(\\DateTime::RFC3339);\n+                } elseif (\\is_object($val)) {\n+                    $replacements[\"{{$key}}\"] = '[object '.\\get_class($val).']';\n+                } else {\n+                    $replacements[\"{{$key}}\"] = '['.\\gettype($val).']';\n+                }\n+            }\n+\n+            $message = strtr($message, $replacements);\n+        }\n+\n+        return sprintf('[%s] %s', $level, $message).\\PHP_EOL;","path":"src/Symfony/Bundle/FrameworkBundle/Logger/Logger.php","position":97,"original_position":97,"commit_id":"77bf522f3774f76c4583f0c6f3c186deaaeab103","original_commit_id":"77bf522f3774f76c4583f0c6f3c186deaaeab103","user":{"login":"shouze","id":54712,"avatar_url":"https://avatars0.githubusercontent.com/u/54712?v=4","gravatar_id":"","url":"https://api.github.com/users/shouze","html_url":"https://github.com/shouze","followers_url":"https://api.github.com/users/shouze/followers","following_url":"https://api.github.com/users/shouze/following{/other_user}","gists_url":"https://api.github.com/users/shouze/gists{/gist_id}","starred_url":"https://api.github.com/users/shouze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shouze/subscriptions","organizations_url":"https://api.github.com/users/shouze/orgs","repos_url":"https://api.github.com/users/shouze/repos","events_url":"https://api.github.com/users/shouze/events{/privacy}","received_events_url":"https://api.github.com/users/shouze/received_events","type":"User","site_admin":false},"body":"would be useful yes but default date format & precision should be decided in this case.","created_at":"2017-09-26T13:40:44Z","updated_at":"2017-09-26T13:40:44Z","html_url":"https://github.com/symfony/symfony/pull/24300#discussion_r141058629","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/24300","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/141058629"},"html":{"href":"https://github.com/symfony/symfony/pull/24300#discussion_r141058629"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24300"}},"in_reply_to_id":141049212},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/24300","id":142730884,"html_url":"https://github.com/symfony/symfony/pull/24300","diff_url":"https://github.com/symfony/symfony/pull/24300.diff","patch_url":"https://github.com/symfony/symfony/pull/24300.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/24300","number":24300,"state":"open","locked":false,"title":"[FrameworkBundle] Add a minimalist default PSR-3 logger","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | 3.4\r\n| Bug fix?      | no\r\n| New feature?  | yes <!-- don't forget updating src/**/CHANGELOG.md files -->\r\n| BC breaks?    | no\r\n| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->\r\n| Tests pass?   | yes\r\n| Fixed tickets | n/a\r\n| License       | MIT\r\n| Doc PR        | n/a\r\n\r\nThis PR provides a minimalist PSR-3 logger that is always available when FrameworkBundle is installed.\r\nBy default, it writes errors on `stderr`, regular logs on `stdout` and discards debug data (this is configurable).\r\n\r\nThis approach has several benefits:\r\n\r\n- It's what expect from an app logging systems of major containerization and orchestration tools including [Docker](https://docs.docker.com/engine/admin/logging/view_container_logs/) and [Kubernetes](https://kubernetes.io/docs/concepts/cluster-administration/logging/), as well as most cloud providers such as [Heroku](https://devcenter.heroku.com/articles/logging#writing-to-your-log) and [Google Container Engine](https://kubernetes.io/docs/tasks/debug-application-cluster/logging-stackdriver/). If the app follows this standard (and it's not currently the case with Symfony by default) logs will be automatically collected, aggregated and stored.\r\n- It's in sync with the \"back to Unix roots\" philosophy of Flex\r\n- Logs are directly displayed in the console when running the integrated PHP web server (`bin/console server:start` or Flex's `make serve`), Create React App also do that for instance.\r\n- It fixes a common problem when installing Flex recipes: many bundles expect a logger service but currently there is none available by default, and you usually get a `\"logger\" service not found error` (because packages depend of the PSR, but the PSR doesn't provide a logger service).","created_at":"2017-09-23T21:51:58Z","updated_at":"2017-09-26T13:40:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"592e67a8e0a1378a21879f66876a44344bf19215","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/symfony/symfony/milestones/10","html_url":"https://github.com/symfony/symfony/milestone/10","labels_url":"https://api.github.com/repos/symfony/symfony/milestones/10/labels","id":2117464,"number":10,"title":"3.4","description":"https://symfony.com/roadmap?version=3.4#checker","creator":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars3.githubusercontent.com/u/73419?v=4","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"open_issues":139,"closed_issues":321,"state":"open","created_at":"2016-11-06T20:24:23Z","updated_at":"2017-09-26T12:37:09Z","due_on":"2017-11-30T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/24300/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/24300/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/24300/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/77bf522f3774f76c4583f0c6f3c186deaaeab103","head":{"label":"dunglas:minimal-logger","ref":"minimal-logger","sha":"77bf522f3774f76c4583f0c6f3c186deaaeab103","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"repo":{"id":1124839,"name":"symfony","full_name":"dunglas/symfony","owner":{"login":"dunglas","id":57224,"avatar_url":"https://avatars2.githubusercontent.com/u/57224?v=4","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dunglas/symfony","description":"The Symfony2 PHP framework (PHP 5.3 only -- not yet stable) -- documentation for master is at http://docs.symfony-reloaded.org/master/","fork":true,"url":"https://api.github.com/repos/dunglas/symfony","forks_url":"https://api.github.com/repos/dunglas/symfony/forks","keys_url":"https://api.github.com/repos/dunglas/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dunglas/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dunglas/symfony/teams","hooks_url":"https://api.github.com/repos/dunglas/symfony/hooks","issue_events_url":"https://api.github.com/repos/dunglas/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/dunglas/symfony/events","assignees_url":"https://api.github.com/repos/dunglas/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/dunglas/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/dunglas/symfony/tags","blobs_url":"https://api.github.com/repos/dunglas/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dunglas/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dunglas/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/dunglas/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dunglas/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/dunglas/symfony/languages","stargazers_url":"https://api.github.com/repos/dunglas/symfony/stargazers","contributors_url":"https://api.github.com/repos/dunglas/symfony/contributors","subscribers_url":"https://api.github.com/repos/dunglas/symfony/subscribers","subscription_url":"https://api.github.com/repos/dunglas/symfony/subscription","commits_url":"https://api.github.com/repos/dunglas/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/dunglas/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/dunglas/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/dunglas/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/dunglas/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/dunglas/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dunglas/symfony/merges","archive_url":"https://api.github.com/repos/dunglas/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dunglas/symfony/downloads","issues_url":"https://api.github.com/repos/dunglas/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/dunglas/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/dunglas/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/dunglas/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dunglas/symfony/labels{/name}","releases_url":"https://api.github.com/repos/dunglas/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/dunglas/symfony/deployments","created_at":"2010-11-30T08:18:04Z","updated_at":"2016-01-28T23:52:00Z","pushed_at":"2017-09-26T13:04:56Z","git_url":"git://github.com/dunglas/symfony.git","ssh_url":"git@github.com:dunglas/symfony.git","clone_url":"https://github.com/dunglas/symfony.git","svn_url":"https://github.com/dunglas/symfony","homepage":"http://www.symfony-project.org/","size":98186,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"symfony:3.4","ref":"3.4","sha":"bc8430418b0ef694ba1ef443064e60fcd6510e33","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars3.githubusercontent.com/u/143937?v=4","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2017-09-26T13:37:24Z","pushed_at":"2017-09-26T13:33:13Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":102663,"stargazers_count":15209,"watchers_count":15209,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":5709,"mirror_url":null,"open_issues_count":865,"forks":5709,"open_issues":865,"watchers":15209,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24300"},"html":{"href":"https://github.com/symfony/symfony/pull/24300"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/24300"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/24300/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24300/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/24300/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/77bf522f3774f76c4583f0c6f3c186deaaeab103"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"shouze"}}