/**
  * Logs a SQL statement to the system logger (DEBUG priority).
  *
  * @param string $sql The SQL to be executed
  * @param array $params The SQL parameters
  * @param array $types The SQL parameter types.
  * @return void
  */
 public function startQuery($sql, array $params = null, array $types = null)
 {
     // this is a safeguard for when no logger might be available...
     if ($this->logger !== null) {
         $this->logger->log($sql, LOG_DEBUG, array('params' => $params, 'types' => $types));
     }
 }
示例#2
0
 /**
  * Logs calls
  *
  * @Flow\After("method(PerfectIn\Api\Webservice\WebserviceCall->invoke())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current joinpoint
  */
 public function logFinishServiceCall(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     $callIdentifier = $joinPoint->getProxy()->getClass() . '::' . $joinPoint->getProxy()->getMethod();
     if ($joinPoint->hasException()) {
         $this->logger->log($this->logIdentifier . ' - error - ' . $joinPoint->getException()->getMessage() . '(' . $joinPoint->getException()->getCode() . ')', LOG_ERR);
     } else {
         $this->logger->log($this->logIdentifier . ' - response - ' . $this->getLogMessageForVariable($joinPoint->getResult()), LOG_INFO);
     }
 }
 /**
  * Returns translated label ("target" tag in XLIFF) for the id given.
  * Id is compared with "id" attribute of "trans-unit" tag (see XLIFF
  * specification for details).
  *
  * @param string $transUnitId The "id" attribute of "trans-unit" tag in XLIFF
  * @param integer $pluralFormIndex Index of plural form to use (starts with 0)
  * @return mixed Translated label or FALSE on failure
  */
 public function getTargetByTransUnitId($transUnitId, $pluralFormIndex = 0)
 {
     if (!isset($this->xmlParsedData['translationUnits'][$transUnitId])) {
         $this->i18nLogger->log('No trans-unit element with the id "' . $transUnitId . '" was found in ' . $this->sourcePath . '. Either this translation has been removed or the id in the code or template referring to the translation is wrong.', LOG_DEBUG);
         return false;
     }
     if (!isset($this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex])) {
         $this->i18nLogger->log('The plural form index "' . $pluralFormIndex . '" for the trans-unit element with the id "' . $transUnitId . '" in ' . $this->sourcePath . ' is not available.', LOG_DEBUG);
         return false;
     }
     if ($this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['target']) {
         return $this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['target'];
     } elseif ($this->locale->getLanguage() === $this->xmlParsedData['sourceLocale']->getLanguage()) {
         return $this->xmlParsedData['translationUnits'][$transUnitId][$pluralFormIndex]['source'] ?: false;
     } else {
         $this->i18nLogger->log('The target translation was empty and the source translation language (' . $this->xmlParsedData['sourceLocale']->getLanguage() . ') does not match the current locale (' . $this->locale->getLanguage() . ') for the trans-unit element with the id "' . $transUnitId . '" in ' . $this->sourcePath, LOG_DEBUG);
         return false;
     }
 }