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:
committed by
Jordi Boggiano
parent
71f16ca3d5
commit
91a0f40927
@@ -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";
|
||||
|
Reference in New Issue
Block a user