Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LoggerDataCollector.php

function LoggerDataCollector::sanitizeLogs

1 call to LoggerDataCollector::sanitizeLogs()
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 220

Class

LoggerDataCollector
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

private function sanitizeLogs(array $logs) : array {
    $sanitizedLogs = [];
    $silencedLogs = [];
    foreach ($logs as $log) {
        if (!$this->isSilencedOrDeprecationErrorLog($log)) {
            $sanitizedLogs[] = $log;
            continue;
        }
        $message = '_' . $log['message'];
        $exception = $log['context']['exception'];
        if ($exception instanceof SilencedErrorContext) {
            if (isset($silencedLogs[$h = spl_object_hash($exception)])) {
                continue;
            }
            $silencedLogs[$h] = true;
            if (!isset($sanitizedLogs[$message])) {
                $sanitizedLogs[$message] = $log + [
                    'errorCount' => 0,
                    'scream' => true,
                ];
            }
            $sanitizedLogs[$message]['errorCount'] += $exception->count;
            continue;
        }
        $errorId = hash('xxh128', "{$exception->getSeverity()}/{$exception->getLine()}/{$exception->getFile()}\x00{$message}", true);
        if (isset($sanitizedLogs[$errorId])) {
            ++$sanitizedLogs[$errorId]['errorCount'];
        }
        else {
            $log += [
                'errorCount' => 1,
                'scream' => false,
            ];
            $sanitizedLogs[$errorId] = $log;
        }
    }
    return array_values($sanitizedLogs);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal