This formatter extends LogstashFormatter to prefix records with "cee token" used for syslog and JSON structured logging. See also related task for more context. Bug: T211124 Change-Id: I3cdeb4c666f54039b5e8ecc67bd4937220333526
17 lines
567 B
PHP
17 lines
567 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Logger\Monolog;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Logger\Monolog\CeeFormatter
|
|
*/
|
|
class CeeFormatterTest extends \PHPUnit\Framework\TestCase {
|
|
public function testV1() {
|
|
$ls_formatter = new LogstashFormatter( 'app', 'system', null, 'ctx_', LogstashFormatter::V1 );
|
|
$cee_formatter = new CeeFormatter( 'app', 'system', null, 'ctx_', LogstashFormatter::V1 );
|
|
$record = [ 'extra' => [ 'url' => 1 ], 'context' => [ 'url' => 2 ] ];
|
|
$this->assertSame(
|
|
$cee_formatter->format( $record ),
|
|
"@cee: " . $ls_formatter->format( $record ) );
|
|
}
|
|
}
|