From 152815436b782796ff1f6f1d7508324dee3c2520 Mon Sep 17 00:00:00 2001 From: Aleksandr Nikitin Date: Mon, 13 Nov 2023 13:55:05 +0300 Subject: [PATCH] add request logger --- composer.lock | 8 ++++---- src/Server.php | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 21aaa26..91fc8e6 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/alexmorbo/trassir-php.git", - "reference": "978ced59bc0ac49230eda3c584a0a28c24955a00" + "reference": "a0ee25465422fe21890f154ebb54a4a3779cd37d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alexmorbo/trassir-php/zipball/978ced59bc0ac49230eda3c584a0a28c24955a00", - "reference": "978ced59bc0ac49230eda3c584a0a28c24955a00", + "url": "https://api.github.com/repos/alexmorbo/trassir-php/zipball/a0ee25465422fe21890f154ebb54a4a3779cd37d", + "reference": "a0ee25465422fe21890f154ebb54a4a3779cd37d", "shasum": "" }, "require": { @@ -48,7 +48,7 @@ "issues": "https://github.com/alexmorbo/trassir-php/issues", "source": "https://github.com/alexmorbo/trassir-php/tree/master" }, - "time": "2023-11-13T10:37:00+00:00" + "time": "2023-11-13T10:54:15+00:00" }, { "name": "clue/http-proxy-react", diff --git a/src/Server.php b/src/Server.php index 1697796..95f1b19 100644 --- a/src/Server.php +++ b/src/Server.php @@ -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); } );