Skip to content

Commit 8c117c8

Browse files
committed
Add request method to logger messages
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 to the log details.
1 parent 3a01792 commit 8c117c8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

EventListener/RouterListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function onKernelRequest(GetResponseEvent $event)
108108
'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a',
109109
'route_parameters' => $parameters,
110110
'request_uri' => $request->getUri(),
111+
'method' => $request->getMethod(),
111112
));
112113
}
113114

Tests/EventListener/RouterListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ public function testLoggingParameter($parameter, $log, $parameters)
150150
public function getLoggingParameterData()
151151
{
152152
return array(
153-
array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/')),
154-
array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/')),
153+
array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/', 'method' => 'GET')),
154+
array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/', 'method' => 'GET')),
155155
);
156156
}
157157
}

0 commit comments

Comments
 (0)