Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ErrorTextFormatter.php « Formatter « Log « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2651ad6386b66a428d5a716a98b7f477472faba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Log\Formatter;

use Piwik\Error;
use Piwik\Log;

/**
 * Formats a log message containing a Piwik\Error object into a textual string.
 */
class ErrorTextFormatter extends Formatter
{
    public function format(array $record, Log $logger)
    {
        $message = $record['message'];

        if ($message instanceof Error) {
            $record['message'] = $message->errfile . '(' . $message->errline . '): ' . Error::getErrNoString($message->errno)
                . ' - ' . $message->errstr . "\n" . $message->backtrace;
        }

        return $this->next($record, $logger);
    }
}