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
5/**
6 * Prefixed version of LogstashFormatter that adds a "cee cookie" for Rsyslog.
7 *
8 * The prefix lets Ryslog differentiate between JSON and non-JSON messages.
9 *
10 * See also: https://www.rsyslog.com/doc/v8-stable/configuration/modules/mmjsonparse.html
11 *
12 * @since 1.33
13 * @ingroup Debug
14 */
15class CeeFormatter extends LogstashFormatter {
16    /**
17     * Format records with a cee cookie
18     * @param array $record
19     * @return string
20     */
21    public function format( array $record ): string {
22        return "@cee: " . parent::format( $record );
23    }
24}