1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

LogstashFormatter: format context and extra fields as JSON objects (#976)

BC Break
* For Logstash, format context as object instead of individual fields
* For Logstash, format extra as object instead of individual fields
This commit is contained in:
Elnur Abdurrakhimov
2017-06-18 19:30:53 -04:00
committed by Jordi Boggiano
parent 71f16ca3d5
commit 91a0f40927
2 changed files with 17 additions and 17 deletions

View File

@@ -90,14 +90,10 @@ class LogstashFormatter extends NormalizerFormatter
$message['type'] = $this->applicationName;
}
if (!empty($record['extra'])) {
foreach ($record['extra'] as $key => $val) {
$message[$this->extraPrefix . $key] = $val;
}
$message[$this->extraPrefix.'extra'] = $record['extra'];
}
if (!empty($record['context'])) {
foreach ($record['context'] as $key => $val) {
$message[$this->contextPrefix . $key] = $val;
}
$message[$this->contextPrefix.'context'] = $record['context'];
}
return $this->toJson($message) . "\n";