| 1 | <?php |
| 2 | |
| 3 | namespace 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 | */ |
| 15 | class 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 | } |