Writes the given message along with the additional information into the log.
public log ( string $message, integer $severity = LOG_INFO, mixed $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null ) : void | ||
$message | string | The message to log |
$severity | integer | An integer value, one of the LOG_* constants |
$additionalData | mixed | A variable containing more information about the event to be logged |
$packageKey | string | Key of the package triggering the log (determined automatically if not specified) |
$className | string | Name of the class triggering the log (determined automatically if not specified) |
$methodName | string | Name of the method triggering the log (determined automatically if not specified) |
Résultat | void |
/** * 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]); } }
/** * 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; } }