feature #18676 [HttpKernel] Add request method to logger messages (gnat42)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpKernel] Add request method to logger messages

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While debugging some functional tests I was looking at the test.log. It would have been quite useful to know if the request was a POST or GET. This adds the request method to the log details.

Commits
-------

d751d59 Add request method to logger messages
This commit is contained in:
Fabien Potencier 2016-05-13 10:12:29 -05:00
commit d02e5eb6a1
2 changed files with 3 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class RouterListener implements EventSubscriberInterface
'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a',
'route_parameters' => $parameters,
'request_uri' => $request->getUri(),
'method' => $request->getMethod(),
));
}

View File

@ -150,8 +150,8 @@ class RouterListenerTest extends \PHPUnit_Framework_TestCase
public function getLoggingParameterData()
{
return array(
array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/')),
array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/')),
array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/', 'method' => 'GET')),
array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/', 'method' => 'GET')),
);
}
}