[HttpKernel] Group deprecation notices
This commit is contained in:
parent
a1d0f539ac
commit
8d6e337602
@ -116,6 +116,10 @@
|
||||
{% set stack = log.context.stack|default([]) %}
|
||||
{% set id = 'sf-call-stack-' ~ log_index %}
|
||||
|
||||
{% if log.context.errorCount is defined %}
|
||||
({{ log.context.errorCount }}x)
|
||||
{% endif %}
|
||||
|
||||
{% if stack %}
|
||||
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
|
||||
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">
|
||||
|
@ -97,15 +97,46 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
private function sanitizeLogs($logs)
|
||||
{
|
||||
foreach ($logs as $i => $log) {
|
||||
$errorContextById = array();
|
||||
$sanitizedLogs = array();
|
||||
|
||||
foreach ($logs as $log) {
|
||||
$context = $this->sanitizeContext($log['context']);
|
||||
if (isset($context['type'], $context['level']) && !($context['type'] & $context['level'])) {
|
||||
$context['scream'] = true;
|
||||
}
|
||||
$logs[$i]['context'] = $context;
|
||||
|
||||
if (isset($context['type'], $context['file'], $context['line'], $context['level'])) {
|
||||
$errorId = md5("{$context['type']}/{$context['line']}/{$context['file']}\x00{$log['message']}", true);
|
||||
$silenced = !($context['type'] & $context['level']);
|
||||
|
||||
if (isset($errorContextById[$errorId])) {
|
||||
if (isset($errorContextById[$errorId]['errorCount'])) {
|
||||
++$errorContextById[$errorId]['errorCount'];
|
||||
} else {
|
||||
$errorContextById[$errorId]['errorCount'] = 2;
|
||||
}
|
||||
|
||||
return $logs;
|
||||
if (!$silenced && isset($errorContextById[$errorId]['scream'])) {
|
||||
unset($errorContextById[$errorId]['scream']);
|
||||
$errorContextById[$errorId]['level'] = $context['level'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$errorContextById[$errorId] = &$context;
|
||||
if ($silenced) {
|
||||
$context['scream'] = true;
|
||||
}
|
||||
|
||||
$log['context'] = &$context;
|
||||
unset($context);
|
||||
} else {
|
||||
$log['context'] = $context;
|
||||
}
|
||||
|
||||
$sanitizedLogs[] = $log;
|
||||
}
|
||||
|
||||
return $sanitizedLogs;
|
||||
}
|
||||
|
||||
private function sanitizeContext($context)
|
||||
|
@ -75,8 +75,18 @@ class LoggerDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
),
|
||||
array(
|
||||
1,
|
||||
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0), 'priority' => 100, 'priorityName' => 'DEBUG')),
|
||||
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
|
||||
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG')),
|
||||
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
|
||||
0,
|
||||
1,
|
||||
),
|
||||
array(
|
||||
1,
|
||||
array(
|
||||
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
|
||||
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
|
||||
),
|
||||
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123, 'errorCount' => 2), 'priority' => 100, 'priorityName' => 'DEBUG')),
|
||||
0,
|
||||
1,
|
||||
),
|
||||
|
Reference in New Issue
Block a user