state = $state; $this->scopeConfig = $scopeConfig; $this->deploymentConfig = $deploymentConfig; } /** * @inheritdoc */ public function isHandling(array $record) { if ($this->deploymentConfig->isAvailable()) { return parent::isHandling($record) && $this->isLoggingEnabled(); } return parent::isHandling($record); } /** * Check that logging functionality is enabled. * * @return bool */ private function isLoggingEnabled(): bool { $configValue = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING); if ($configValue === null) { $isEnabled = $this->state->getMode() !== State::MODE_PRODUCTION; } else { $isEnabled = (bool)$configValue; } return $isEnabled; } }