feat: integrate Monolog for enhanced logging across providers and controller

This commit is contained in:
2026-05-29 18:57:25 +02:00
parent 8b8ec9ab2f
commit cceda8abf2
11 changed files with 226 additions and 2 deletions
+11
View File
@@ -2,6 +2,7 @@
namespace App\Service;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
@@ -16,6 +17,7 @@ class GitLabProvider implements ProviderInterface
private readonly HttpClientInterface $client,
private readonly string $username,
private readonly string $token,
private readonly LoggerInterface $logger,
private readonly string $baseUrl = '',
) {}
@@ -31,6 +33,8 @@ class GitLabProvider implements ProviderInterface
{
$baseUrl = rtrim($this->baseUrl !== '' ? $this->baseUrl : 'https://gitlab.com', '/');
$this->logger->debug('GitLabProvider: fetching contributions', ['user' => $this->username, 'url' => $baseUrl]);
// Resolve numeric user ID from username
$userResponse = $this->client->request('GET', "$baseUrl/api/v4/users", [
'headers' => ['PRIVATE-TOKEN' => $this->token],
@@ -67,6 +71,13 @@ class GitLabProvider implements ProviderInterface
$page++;
} while (count($events) === 100);
$this->logger->info('GitLabProvider: fetched contributions', [
'user' => $this->username,
'pages' => $page - 1,
'days' => count($result),
'total' => array_sum($result),
]);
return $result;
}
}