HEX
Server: Apache
System: Linux sxb1plzcpnl440011.prod.sxb1.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: xfp2mtarcm67 (7705020)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: //proc/self/cwd/wp-content/plugins/worker/src/Monolog/Processor/PsrLogMessageProcessor.php
<?php

/*
 * This file is part of the Monolog package.
 *
 * (c) Jordi Boggiano <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Processes a record's message according to PSR-3 rules
 *
 * It replaces {foo} with the value from $context['foo']
 *
 * @author Jordi Boggiano <[email protected]>
 */
class Monolog_Processor_PsrLogMessageProcessor implements Monolog_Processor_ProcessorInterface
{
    /**
     * @param array $record
     *
     * @return array
     */
    public function callback(array $record)
    {
        if (false === strpos($record['message'], '{')) {
            return $record;
        }

        $replacements = array();
        foreach ($record['context'] as $key => $val) {
            if (!is_scalar($val) && !is_callable($val, '__toString')) {
                continue;
            }
            $replacements['{'.$key.'}'] = $val;
        }

        $record['message'] = strtr($record['message'], $replacements);

        return $record;
    }
}