Skip to content

Commit

Permalink
add request logger
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmorbo committed Nov 13, 2023
1 parent 25fa430 commit 1528154
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ private function initServer(string $ip, int $port): int
$router = $this->getRouter();

$http = new HttpServer(
static function (ServerRequestInterface $request) use ($router) {
function (ServerRequestInterface $request) use ($router) {
$this->logger->debug('New request', [
'uri' => $request->getUri(),
'method' => $request->getMethod(),
'remote_addr' => $request->getServerParams()['REMOTE_ADDR']
]);
return $router->run($request);
}
);
Expand Down

0 comments on commit 1528154

Please sign in to comment.