1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 15:44:34 +02:00

Fix date/time field for GCP logging (#1759)

We introduced the formatter using the incorrect field, which was making
GCP not to extract the correct value from the payload.

This uses the field that actually maps to the expected format.

More info: https://cloud.google.com/logging/docs/structured-logging
This commit is contained in:
Luís Cobucci
2023-02-04 11:39:20 -03:00
committed by GitHub
parent e18aa33d2f
commit 69bd3637ba
2 changed files with 4 additions and 3 deletions

View File

@@ -30,8 +30,8 @@ class GoogleCloudLoggingFormatterTest extends TestCase
$formatted_decoded = json_decode($formatter->format($record), true);
$this->assertArrayNotHasKey("datetime", $formatted_decoded);
$this->assertArrayHasKey("timestamp", $formatted_decoded);
$this->assertSame($record->datetime->format(DateTimeInterface::RFC3339_EXTENDED), $formatted_decoded["timestamp"]);
$this->assertArrayHasKey("time", $formatted_decoded);
$this->assertSame($record->datetime->format(DateTimeInterface::RFC3339_EXTENDED), $formatted_decoded["time"]);
}
/**