Skip to content

Commit

Permalink
RequestIdProcessor added
Browse files Browse the repository at this point in the history
  • Loading branch information
yapro committed Sep 17, 2024
1 parent 7dcf88b commit c673db0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Processor/RequestIdProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php declare(strict_types=1);

namespace YaPro\MonologExt\Processor;

use Monolog\Processor\ProcessorInterface;

class RequestIdProcessor implements ProcessorInterface
{
/**
* {@inheritDoc}
*/
public function __invoke(array $record): array
{
$record['extra']['request_id'] = $_SERVER['REQUEST_ID'] ?? '-';
$record['extra']['request_id_forwarded'] = $_SERVER['HTTP_X_FORWARDED_REQUEST_ID'] ?? '-';

return $record;
}
}

0 comments on commit c673db0

Please sign in to comment.