You are here

private function LoggerDataCollector::computeErrorsCount in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php \Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector::computeErrorsCount()
1 call to LoggerDataCollector::computeErrorsCount()
LoggerDataCollector::lateCollect in vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php
Collects data as late as possible.

File

vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php, line 163

Class

LoggerDataCollector
LogDataCollector.

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

private function computeErrorsCount() {
  $count = array(
    'error_count' => $this->logger
      ->countErrors(),
    'deprecation_count' => 0,
    'scream_count' => 0,
    'priorities' => array(),
  );
  foreach ($this->logger
    ->getLogs() as $log) {
    if (isset($count['priorities'][$log['priority']])) {
      ++$count['priorities'][$log['priority']]['count'];
    }
    else {
      $count['priorities'][$log['priority']] = array(
        'count' => 1,
        'name' => $log['priorityName'],
      );
    }
    if (isset($log['context']['type'], $log['context']['level'])) {
      if (E_DEPRECATED === $log['context']['type'] || E_USER_DEPRECATED === $log['context']['type']) {
        ++$count['deprecation_count'];
      }
      elseif (!($log['context']['type'] & $log['context']['level'])) {
        ++$count['scream_count'];
      }
    }
  }
  ksort($count['priorities']);
  return $count;
}