Skip to content

Commit

Permalink
OXDEV-7785 Log level
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafOxid committed May 14, 2024
1 parent 16b7d58 commit 96493ef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function get(): SystemConfiguration
$systemConfiguration->setDatabaseUrl(getenv('OXID_DB_URL'));
$systemConfiguration->setShopDirectory(getenv('OXID_SHOP_DIRECTORY'));
$systemConfiguration->setCompilationDirectory(getenv('OXID_COMPILATION_DIRECTORY'));
$systemConfiguration->setLogLevel(getenv('OXID_LOG_LEVEL'));

return $systemConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class SystemConfiguration
private string $shopDirectory;
private string $compilationDirectory;

private string $logLevel;

public function getDatabaseUrl(): string
{
return $this->databaseUrl;
Expand Down Expand Up @@ -44,4 +46,14 @@ public function setCompilationDirectory(string $compilationDirectory): void
{
$this->compilationDirectory = $compilationDirectory;
}

public function getLogLevel(): string
{
return $this->logLevel;
}

public function setLogLevel(string $logLevel): void
{
$this->logLevel = $logLevel;
}
}
2 changes: 1 addition & 1 deletion source/Internal/Transition/Utility/BasicContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BasicContext implements BasicContextInterface
*/
private $facts;

private SystemConfiguration $systemConfiguration;
protected SystemConfiguration $systemConfiguration;

public function __construct()
{
Expand Down
5 changes: 2 additions & 3 deletions source/Internal/Transition/Utility/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use OxidEsales\Eshop\Core\FileCache;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\ShopIdCalculator;
use OxidEsales\EshopCommunity\Core\Di\ContainerFacade;
use OxidEsales\EshopCommunity\Internal\Framework\Database\BootstrapConnectionFactory;
use OxidEsales\EshopCommunity\Internal\Transition\Utility\Exception\AdminUserNotFoundException;
use OxidEsales\Facts\Config\ConfigFile as FactsConfigFile;
Expand All @@ -34,15 +33,15 @@ class Context extends BasicContext implements ContextInterface
*/
public function getLogLevel(): string
{
return $this->getFactsConfigFile()->getVar('sLogLevel') ?? LogLevel::ERROR;
return $this->systemConfiguration->getLogLevel() ?? LogLevel::ERROR;
}

/**
* @return string
*/
public function getLogFilePath(): string
{
return Path::join(ContainerFacade::getParameter('oxid_shop_directory'), 'log', 'oxideshop.log');
return Path::join($this->getSourcePath(), 'log', 'oxideshop.log');
}

/**
Expand Down
5 changes: 0 additions & 5 deletions source/config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ $this->aAllowedUploadTypes = array('jpg', 'gif', 'png', 'pdf', 'mp3', 'avi', 'mp
// Timezone information
date_default_timezone_set('Europe/Berlin');

/**
* String PSR3 log level Psr\Log\LogLevel
*/
$this->sLogLevel = 'error';

/**
* Log all modifications performed in Admin
*/
Expand Down

0 comments on commit 96493ef

Please sign in to comment.