wiki.techinc.nl/tests/phpunit/includes/debug/logger/monolog/CeeFormatterTest.php
Filippo Giunchedi 667b17a319 monolog: add CeeFormatter
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
2018-12-07 09:04:54 +01:00

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 ) );
}
}