Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
CeeFormatter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 format
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Logger\Monolog;
4
5use Monolog\LogRecord;
6
7/**
8 * Prefixed version of LogstashFormatter that adds a "cee cookie" for Rsyslog.
9 *
10 * The prefix lets Ryslog differentiate between JSON and non-JSON messages.
11 *
12 * See also: https://www.rsyslog.com/doc/v8-stable/configuration/modules/mmjsonparse.html
13 *
14 * @since 1.33
15 * @ingroup Debug
16 */
17class CeeFormatter extends LogstashFormatter {
18    /**
19     * Format records with a cee cookie
20     * @param LogRecord $record
21     * @return string
22     */
23    public function format( LogRecord $record ): string {
24        return "@cee: " . parent::format( $record );
25    }
26}