$21 GRAYBYTE WORDPRESS FILE MANAGER $32

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/php54/usr/share/pear/Symfony/Component/HttpKernel/DataCollector/

HOME
Current File : /opt/alt/php54/usr/share/pear/Symfony/Component/HttpKernel/DataCollector//LoggerDataCollector.php
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpKernel\DataCollector;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;

/**
 * LogDataCollector.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class LoggerDataCollector extends DataCollector implements LateDataCollectorInterface
{
    private $logger;

    public function __construct($logger = null)
    {
        if (null !== $logger && $logger instanceof DebugLoggerInterface) {
            $this->logger = $logger;
        }
    }

    /**
     * {@inheritdoc}
     */
    public function collect(Request $request, Response $response, \Exception $exception = null)
    {
        // everything is done as late as possible
    }

    /**
     * {@inheritdoc}
     */
    public function lateCollect()
    {
        if (null !== $this->logger) {
            $this->data = array(
                'error_count'       => $this->logger->countErrors(),
                'logs'              => $this->sanitizeLogs($this->logger->getLogs()),
                'deprecation_count' => $this->computeDeprecationCount()
            );
        }
    }

    /**
     * Gets the called events.
     *
     * @return array An array of called events
     *
     * @see TraceableEventDispatcherInterface
     */
    public function countErrors()
    {
        return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
    }

    /**
     * Gets the logs.
     *
     * @return array An array of logs
     */
    public function getLogs()
    {
        return isset($this->data['logs']) ? $this->data['logs'] : array();
    }

    public function countDeprecations()
    {
        return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'logger';
    }

    private function sanitizeLogs($logs)
    {
        foreach ($logs as $i => $log) {
            $logs[$i]['context'] = $this->sanitizeContext($log['context']);
        }

        return $logs;
    }

    private function sanitizeContext($context)
    {
        if (is_array($context)) {
            foreach ($context as $key => $value) {
                $context[$key] = $this->sanitizeContext($value);
            }

            return $context;
        }

        if (is_resource($context)) {
            return sprintf('Resource(%s)', get_resource_type($context));
        }

        if (is_object($context)) {
            return sprintf('Object(%s)', get_class($context));
        }

        return $context;
    }

    private function computeDeprecationCount()
    {
        $count = 0;
        foreach ($this->logger->getLogs() as $log) {
            if (isset($log['context']['type']) && ErrorHandler::TYPE_DEPRECATION === $log['context']['type']) {
                $count++;
            }
        }

        return $count;
    }
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 7.05 AM
root / root
0755
Util
--
31 Aug 2024 7.05 AM
root / root
0755
ConfigDataCollector.php
6.123 KB
18 Dec 2019 6.22 PM
root / root
0644
DataCollector.php
1.294 KB
18 Dec 2019 6.22 PM
root / root
0644
DataCollectorInterface.php
1.02 KB
18 Dec 2019 6.22 PM
root / root
0644
EventDataCollector.php
2.625 KB
18 Dec 2019 6.22 PM
root / root
0644
ExceptionDataCollector.php
2.156 KB
18 Dec 2019 6.22 PM
root / root
0644
LateDataCollectorInterface.php
0.506 KB
18 Dec 2019 6.22 PM
root / root
0644
LoggerDataCollector.php
3.181 KB
18 Dec 2019 6.22 PM
root / root
0644
MemoryDataCollector.php
2.308 KB
18 Dec 2019 6.22 PM
root / root
0644
RequestDataCollector.php
10.229 KB
18 Dec 2019 6.22 PM
root / root
0644
RouterDataCollector.php
2.358 KB
18 Dec 2019 6.22 PM
root / root
0644
TimeDataCollector.php
3.154 KB
18 Dec 2019 6.22 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF