for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Monolog;
use Monolog\Formatter\FormatterInterface;
class LineFormatter implements FormatterInterface {
/**
* @inheritDoc
*/
public function format(array $record): mixed {
$line = $record['message'];
foreach($record['context'] as $key => $value) {
$line = str_replace('{' . $key . '}', is_scalar($value) ? $value : json_encode($value, JSON_THROW_ON_ERROR), $line);
}
return $line;
public function formatBatch(array $records): array {
foreach($records as $key => $record) {
$records[$key] = $this->format($record);
return $records;