13 $formatter =
new LogstashFormatter(
'app',
'system',
null,
null, LogstashFormatter::V1 );
14 $formatted = json_decode( $formatter->format( $record ),
true );
15 foreach ( $expected
as $key =>
$value ) {
16 $this->assertArrayHasKey( $key, $formatted );
17 $this->assertSame(
$value, $formatted[$key] );
19 foreach ( $notExpected
as $key ) {
20 $this->assertArrayNotHasKey( $key, $formatted );
46 $formatter =
new LogstashFormatter(
'app',
'system',
null,
'ctx_', LogstashFormatter::V1 );
47 $record = [
'extra' => [
'url' => 1 ],
'context' => [
'url' => 2 ] ];
48 $formatted = json_decode( $formatter->format( $record ),
true );
49 $this->assertArrayHasKey(
'url', $formatted );
50 $this->assertSame( 1, $formatted[
'url'] );
51 $this->assertArrayHasKey(
'ctx_url', $formatted );
52 $this->assertSame( 2, $formatted[
'ctx_url'] );
53 $this->assertArrayNotHasKey(
'c_url', $formatted );