getProcessedLogs example

$logger = $this
            ->getMockBuilder(DebugLoggerInterface::class)
            ->onlyMethods(['countErrors', 'getLogs', 'clear'])
            ->getMock();

        $logger->expects($this->once())->method('countErrors')->willReturn(0);
        $logger->expects($this->exactly(2))->method('getLogs')->willReturn([]);

        $c = new LoggerDataCollector($logger$containerPathPrefix);
        $c->lateCollect();

        $processedLogs = $c->getProcessedLogs();

        $this->assertCount(1, $processedLogs);

        $this->assertEquals($processedLogs[0]['type'], 'deprecation');
        $this->assertEquals($processedLogs[0]['errorCount'], 1);
        $this->assertEquals($processedLogs[0]['timestamp'](new \DateTimeImmutable())->setTimestamp(filemtime($path))->format(\DateTimeInterface::RFC3339_EXTENDED));
        $this->assertEquals($processedLogs[0]['priority'], 100);
        $this->assertEquals($processedLogs[0]['priorityName'], 'DEBUG');
        $this->assertNull($processedLogs[0]['channel']);

        $this->assertInstanceOf(Data::class$processedLogs[0]['message']);
        
'Info' => 200,
                'Notice' => 250,
                'Warning' => 300,
                'Error' => 400,
                'Critical' => 500,
                'Alert' => 550,
                'Emergency' => 600,
            ],
        ];

        $allChannels = [];
        foreach ($this->getProcessedLogs() as $log) {
            if ('' === trim($log['channel'] ?? '')) {
                continue;
            }

            $allChannels[] = $log['channel'];
        }
        $channels = array_unique($allChannels);
        sort($channels);
        $filters['channel'] = $channels;

        return $filters;
    }
'Info' => 200,
                'Notice' => 250,
                'Warning' => 300,
                'Error' => 400,
                'Critical' => 500,
                'Alert' => 550,
                'Emergency' => 600,
            ],
        ];

        $allChannels = [];
        foreach ($this->getProcessedLogs() as $log) {
            if ('' === trim($log['channel'] ?? '')) {
                continue;
            }

            $allChannels[] = $log['channel'];
        }
        $channels = array_unique($allChannels);
        sort($channels);
        $filters['channel'] = $channels;

        return $filters;
    }
Home | Imprint | This part of the site doesn't use cookies.