# worker/4.9.25/src/Monolog/Processor/PsrLogMessageProcessor.php

ManageWP Worker, version 4.9.25. 45 lines.

- Page: https://pluginprobe.com/plugins/worker/4.9.25/code/src/Monolog/Processor/PsrLogMessageProcessor.php
- Raw: https://pluginprobe.com/plugins/worker/4.9.25/raw/src/Monolog/Processor/PsrLogMessageProcessor.php
- Modified: 2014-11-24T12:40:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/worker/4.9.25/code/src/Monolog/Processor/PsrLogMessageProcessor.php#L10-L20`.

```php
<?php

/*
 * This file is part of the Monolog package.
 *
 * (c) Jordi Boggiano <j.boggiano@seld.be>
 *
 * 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 <j.boggiano@seld.be>
 */
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;
    }
}

```
