Skip to content

Commit

Permalink
Merge pull request #107 from gigya/develop
Browse files Browse the repository at this point in the history
Variable type fix for setup:di:compile to pass
  • Loading branch information
Ynhockey authored Feb 26, 2021
2 parents a22ebb6 + 00dea09 commit 0f8efa6
Showing 1 changed file with 49 additions and 46 deletions.
95 changes: 49 additions & 46 deletions Logger/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,53 @@

class Logger extends \Monolog\Logger
{
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;

/**
* Logger constructor.
* @param $name
* @param ScopeConfigInterface $scopeConfig
* @param array $handlers
* @param array $processors
*/
public function __construct(
$name,
ScopeConfigInterface $scopeConfig,
array $handlers = array(),
array $processors = array()) {
$this->scopeConfig = $scopeConfig;

parent::__construct($name, $handlers, $processors);
}

/**
* Adds a log record.
*
* @param int $level The logging level
* @param string $message The log message
* @param array $context The log context
* @return bool Whether the record has been processed
*/
public function addRecord($level, $message, array $context = array())
{
$debugMode = $this->scopeConfig->getValue(GigyaConfig::XML_PATH_DEBUG_MODE, 'website');

if ($level != self::CRITICAL) {
if ($debugMode == 0) {
return false;
}

if ($debugMode == 1 && $level == self::DEBUG) {
return false;
}
}

return parent::addRecord($level, $message, $context);
}
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;

/**
* Logger constructor.
*
* @param string $name
* @param ScopeConfigInterface $scopeConfig
* @param array $handlers
* @param array $processors
*/
public function __construct(
string $name,
ScopeConfigInterface $scopeConfig,
array $handlers = [],
array $processors = []
) {
$this->scopeConfig = $scopeConfig;

parent::__construct($name, $handlers, $processors);
}

/**
* Adds a log record.
*
* @param int $level The logging level
* @param string $message The log message
* @param array $context The log context
*
* @return bool Whether the record has been processed
*/
public function addRecord($level, $message, array $context = [])
{
$debugMode = $this->scopeConfig->getValue(GigyaConfig::XML_PATH_DEBUG_MODE, 'website');

if ($level != self::CRITICAL) {
if ($debugMode == 0) {
return false;
}

if ($debugMode == 1 && $level == self::DEBUG) {
return false;
}
}

return parent::addRecord($level, $message, $context);
}
}

0 comments on commit 0f8efa6

Please sign in to comment.