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

FileFormatter.php « Log « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 960c67a2606daad58177f23841169a687e8108fb (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
31
32
33
34
35
36
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Piwik
 * @package Piwik
 */
namespace Piwik\Log;
use Piwik\Common;

/**
 * @package Piwik
 * @subpackage Log
 */
class FileFormatter implements \Zend_Log_Formatter_Interface
{
    /**
     * Formats data into a single line to be written by the writer.
     *
     * @param  array $event    event data
     * @return string             formatted line to write to the log
     */
    public function format($event)
    {
        foreach ($event as &$value) {
            $value = str_replace("\n", '\n', $value);
            $value = '"' . $value . '"';
        }
        $ts = $event['timestamp'];
        unset($event['timestamp']);
        return $ts . ' ' . implode(" ", $event) . "\n";
    }
}