GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: /var/www/admin.fixgini.com/vendor/cloudinary/cloudinary_php/src/Log/LoggerDecorator.php
<?php
/**
 * This file is part of the Cloudinary PHP package.
 *
 * (c) Cloudinary
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cloudinary\Log;

use Cloudinary\Configuration\LoggingConfig;
use Monolog\Handler\HandlerInterface;
use Monolog\Handler\TestHandler;
use Psr\Log\LoggerInterface;

/**
 * Backwards compatibility with PSR Log v1.
 */
$r = new \ReflectionClass(LoggerInterface::class);
if (PHP_MAJOR_VERSION < 7 || !$r->getMethod('log')->hasReturnType()) {
    /**
     * Logger decorator trait that exposes PSR-3 Logger methods.
     */
    trait LoggerDecoratorTrait
    {
        use LoggerDecoratorV1Trait;
    }
} else {
    /**
     * Logger decorator trait that exposes PSR-3 Logger methods.
     */
    trait LoggerDecoratorTrait
    {
        use LoggerDecoratorV3Trait;
    }
}

/**
 * Logger decorator that instantiates logger by configuration and exposes PSR-3 Logger methods
 */
class LoggerDecorator implements LoggerInterface
{
    use LoggerDecoratorTrait;
    /**
     * @var Logger
     */
    private $logger;

    /**
     * @var LoggingConfig
     */
    private $config;

    /**
     * LoggerDecorator constructor.
     *
     * @param LoggingConfig|null $config
     */
    public function __construct(LoggingConfig $config = null)
    {
        $this->config = $config;
    }

    /**
     * Get the TestHandler (if one has been defined)
     *
     * @return TestHandler|null
     */
    public function getTestHandler()
    {
        if ($this->logger !== null) {
            return $this->logger->getTestHandler();
        }

        return null;
    }

    /**
     * Get all Monolog handlers used by this logger
     *
     * @return HandlerInterface[]
     */
    public function getHandlers()
    {
        if ($this->logger !== null) {
            return $this->logger->getHandlers();
        }

        return [];
    }
}