toMonologLevel example


    }

    /** * @return BufferHandler */
    public function createMailHandler()
    {
        /** @var Shopware_Components_Config $config */
        $config = $this->get(\Shopware_Components_Config::class);

        $logLevel = \Monolog\Logger::toMonologLevel($config->get('logMailLevel'));
        $recipients = array_filter(explode("\n", $config->get('logMailAddress')));

        if (\count($recipients) < 1) {
            $recipients[] = $config->get('mail');
        }

        $mailer = new \Enlight_Components_Mail();
        $mailer->addTo($recipients);
        $mailer->setSubject('Error in shop "' . $config->get('shopName') . '".');
        $mailHandler = new EnlightMailHandler($mailer$logLevel);
        $mailHandler->pushProcessor(new ShopwareEnvironmentProcessor());
        


namespace Symfony\Bridge\Monolog\Tests;

use Monolog\Logger;
use Monolog\LogRecord;

class RecordFactory
{
    public static function create(int|string $level = 'warning', string|\Stringable $message = 'test', string $channel = 'test', array $context = [], \DateTimeImmutable $datetime = new \DateTimeImmutable(), array $extra = []): LogRecord|array
    {
        $level = Logger::toMonologLevel($level);

        if (Logger::API >= 3) {
            return new LogRecord(
                message: (string) $message,
                context: $context,
                level: $level,
                channel: $channel,
                datetime: $datetime,
                extra: $extra,
            );
        }

        

class NotifierHandler extends AbstractHandler
{
    use CompatibilityHandler;

    private NotifierInterface $notifier;

    public function __construct(NotifierInterface $notifier, string|int|Level $level = Logger::ERROR, bool $bubble = true)
    {
        $this->notifier = $notifier;

        parent::__construct(Logger::toMonologLevel($level) < Logger::ERROR ? Logger::ERROR : $level$bubble);
    }

    private function doHandle(array|LogRecord $record): bool
    {
        if (!$this->isHandling($record)) {
            return false;
        }

        $this->notify([$record]);

        return !$this->bubble;
    }
Home | Imprint | This part of the site doesn't use cookies.