state = $state; $this->deploymentConfig = $deploymentConfig; } /** * @inheritdoc */ public function isHandling(array $record): bool { if ($this->deploymentConfig->isAvailable()) { return parent::isHandling($record) && $this->isLoggingEnabled(); } return parent::isHandling($record); } /** * Check that logging functionality is enabled * * @return bool * @throws FileSystemException * @throws RuntimeException */ 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; } }