Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 621
Zeile 15... Zeile 15...
15
use Monolog\LogRecord;
15
use Monolog\LogRecord;
Zeile 16... Zeile 16...
16
 
16
 
17
/**
17
/**
18
 * Encodes message information into JSON in a format compatible with Cloud logging.
18
 * Encodes message information into JSON in a format compatible with Cloud logging.
-
 
19
 *
19
 *
20
 * @see https://cloud.google.com/logging/docs/structured-logging
20
 * @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
21
 * @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
21
 *
22
 *
22
 * @author Luís Cobucci <lcobucci@gmail.com>
23
 * @author Luís Cobucci <lcobucci@gmail.com>
23
 */
24
 */
Zeile 26... Zeile 27...
26
    /** {@inheritdoc} **/
27
    /** {@inheritdoc} **/
27
    public function format(array $record): string
28
    public function format(array $record): string
28
    {
29
    {
29
        // Re-key level for GCP logging
30
        // Re-key level for GCP logging
30
        $record['severity'] = $record['level_name'];
31
        $record['severity'] = $record['level_name'];
31
        $record['timestamp'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED);
32
        $record['time'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED);
Zeile 32... Zeile 33...
32
 
33
 
33
        // Remove keys that are not used by GCP
34
        // Remove keys that are not used by GCP
Zeile 34... Zeile 35...
34
        unset($record['level'], $record['level_name'], $record['datetime']);
35
        unset($record['level'], $record['level_name'], $record['datetime']);