The severities are (according to RFC3164) the PHP constants: LOG_EMERG # Emergency: system is unusable LOG_ALERT # Alert: action must be taken immediately LOG_CRIT # Critical: critical conditions LOG_ERR # Error: error conditions LOG_WARNING # Warning: warning conditions LOG_NOTICE # Notice: normal but significant condition LOG_INFO # Informational: informational messages LOG_DEBUG # Debug: debug-level messages
Ejemplo n.º 1
0
 /**
  * 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, ['params' => $params, 'types' => $types]);
     }
 }
Ejemplo n.º 2
0
 /**
  * For the given $token an activation link is returned.
  *
  * @param Token $token
  * @return string
  * @throws InvalidTokenException
  */
 public function getActivationLink(Token $token)
 {
     $activationConfiguration = $token->getPreset()['activation'];
     $tokenHash = $token->getHash();
     if ($activationConfiguration['uri'] === NULL) {
         throw new \RuntimeException('Building activation link failed, no uri configuration is set', 1434728943);
     } elseif (is_array($activationConfiguration['uri'])) {
         $routerConfiguration = $activationConfiguration['uri'];
         $this->uriBuilder->setRequest($this->request);
         $uri = $this->uriBuilder->setCreateAbsoluteUri(TRUE)->setFormat($routerConfiguration['@format'])->uriFor($routerConfiguration['@action'], $routerConfiguration['arguments'], $routerConfiguration['@controller'], $routerConfiguration['@package'], $routerConfiguration['@subpackage']);
     } elseif (is_string($activationConfiguration['uri'])) {
         $uri = $activationConfiguration['uri'];
     } else {
         throw new \RuntimeException('Building activation link failed, uri configuration is invalid (neither array nor string)', 1434732898);
     }
     $this->logger->log(sprintf('Activation link built for token with hash %s', $tokenHash, $token->getIdentifier()), LOG_INFO);
     return str_replace('-tokenhash-', $tokenHash, $uri);
 }
 /**
  * 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;
     }
 }