Skip to content

Commit

Permalink
add debug logging to for proxy config
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Brahmer <[email protected]>
  • Loading branch information
Grotax committed Jan 5, 2025
1 parent 87322cb commit eb171d1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/Config/FetcherConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace OCA\News\Config;

use FeedIo\Adapter\ClientInterface;
use Psr\Log\LoggerInterface;
use \GuzzleHttp\Client;
use OCA\News\AppInfo\Application;
use OCA\News\Fetcher\Client\FeedIoClient;
Expand Down Expand Up @@ -72,15 +73,24 @@ class FetcherConfig
* @var int
*/
public const SLEEPY_DURATION = 86400;

/**
* Logger
* @var LoggerInterface
*/
private LoggerInterface $logger;

/**
* FetcherConfig constructor.
*
* @param IAppConfig $config App configuration
* @param IConfig $systemconfig System configuration
* @param IAppManager $appManager App manager
* @param LoggerInterface $logger Logger
*/
public function __construct(IAppConfig $config, IConfig $systemconfig, IAppManager $appManager)
public function __construct(IAppConfig $config, IConfig $systemconfig, IAppManager $appManager, LoggerInterface $logger)
{
$this->logger = $logger;
$this->version = $appManager->getAppVersion(Application::NAME);
$this->client_timeout = $config->getValueInt(
Application::NAME,
Expand All @@ -95,8 +105,12 @@ public function __construct(IAppConfig $config, IConfig $systemconfig, IAppManag

$proxy = $systemconfig->getSystemValue('proxy', null);
if (is_null($proxy)) {
$this->logger->debug('No proxy configuration found');
return $this;
}
$this->logger->debug('Proxy configuration found: {proxy}',
['proxy' => $proxy]
);

$url = new Net_URL2($proxy);

Expand All @@ -108,6 +122,10 @@ public function __construct(IAppConfig $config, IConfig $systemconfig, IAppManag

$this->proxy = $url->getNormalizedURL();

$this->logger->debug('Proxy configuration finalized: {proxy}',
['proxy' => $proxy]
);

return $this;
}

Expand Down

0 comments on commit eb171d1

Please sign in to comment.