本文整理汇总了PHP中TYPO3\Flow\Log\SystemLoggerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP SystemLoggerInterface类的具体用法?PHP SystemLoggerInterface怎么用?PHP SystemLoggerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SystemLoggerInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleException
/**
* Handles the given exception
*
* @param object $exception The exception object - can be \Exception, or some type of \Throwable in PHP 7
* @return void
*/
public function handleException($exception)
{
// Ignore if the error is suppressed by using the shut-up operator @
if (error_reporting() === 0) {
return;
}
$this->renderingOptions = $this->resolveCustomRenderingOptions($exception);
if (is_object($this->systemLogger) && isset($this->renderingOptions['logException']) && $this->renderingOptions['logException']) {
if ($exception instanceof \Throwable) {
if ($this->systemLogger instanceof ThrowableLoggerInterface) {
$this->systemLogger->logThrowable($exception);
} else {
// Convert \Throwable to \Exception for non-supporting logger implementations
$this->systemLogger->logException(new \Exception($exception->getMessage(), $exception->getCode()));
}
} elseif ($exception instanceof \Exception) {
$this->systemLogger->logException($exception);
}
}
switch (PHP_SAPI) {
case 'cli':
$this->echoExceptionCli($exception);
break;
default:
$this->echoExceptionWeb($exception);
}
}
示例2: getCurrentUserNode
/**
* @return NodeInterface
*/
public function getCurrentUserNode()
{
try {
return $this->profileService->getCurrentPartyProfile();
} catch (\Exception $exception) {
$this->systemLogger->log('Profile node could not be fetched: ' . $exception->getMessage(), LOG_CRIT);
}
}
示例3: getCachedMatchResults
/**
* Checks the cache for the route path given in the Request and returns the result
*
* @param Request $httpRequest
* @return array|boolean the cached route values or FALSE if no cache entry was found
*/
public function getCachedMatchResults(Request $httpRequest)
{
$cachedResult = $this->routeCache->get($this->buildRouteCacheIdentifier($httpRequest));
if ($cachedResult !== FALSE) {
$this->systemLogger->log(sprintf('Router route(): A cached Route with the cache identifier "%s" matched the path "%s".', $this->buildRouteCacheIdentifier($httpRequest), $httpRequest->getRelativePath()), LOG_DEBUG);
}
return $cachedResult;
}
示例4: handle
/**
* Provides an XML comment containing the exception
*
* @param string $typoScriptPath path causing the exception
* @param \Exception $exception exception to handle
* @param integer $referenceCode
* @return string
*/
protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
{
$this->systemLogger->logException($exception);
if (isset($referenceCode)) {
return sprintf('<!-- Exception while rendering %s: %s (%s) -->', $this->formatScriptPath($typoScriptPath, ''), htmlspecialchars($exception->getMessage()), $referenceCode);
} else {
return sprintf('<!-- Exception while rendering %s: %s -->', $this->formatScriptPath($typoScriptPath, ''), htmlspecialchars($exception->getMessage()));
}
}
示例5: processReceiverGroup
private function processReceiverGroup(ReceiverGroup $receiverGroup, $language = NULL)
{
$cacheFileName = $receiverGroup->getCacheFileName($language);
$jqProcess = escapeshellarg('cat ' . escapeshellcmd($receiverGroup->getReceiverSource()->getSourceFileName()) . ' | jq -c ' . escapeshellarg($this->convertFilterIntoJqExpression($receiverGroup->getFilter($language))) . ' > ' . escapeshellcmd($cacheFileName) . ' ; wc -l < ' . escapeshellcmd($cacheFileName) . ' > ' . escapeshellcmd($cacheFileName . '.lines'));
$finalProcess = 'nohup /bin/bash -c ' . $jqProcess . ' &';
$this->systemLogger->log('Starting process: ' . $finalProcess);
$proc = new Process($finalProcess);
$proc->start();
}
示例6: initializeSession
/**
* Before advice for all methods annotated with "@Flow\Session(autoStart=true)".
* Those methods will trigger a session initialization if a session does not exist
* yet.
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return void
* @fixme The pointcut expression below does not consider the options of the session annotation – needs adjustments in the AOP framework
* @Flow\Before("methodAnnotatedWith(TYPO3\Flow\Annotations\Session)")
*/
public function initializeSession(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
if ($this->session->isStarted() === TRUE) {
return;
}
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$this->systemLogger->log(sprintf('Session initialization triggered by %s->%s.', $objectName, $methodName), LOG_DEBUG);
$this->session->start();
}
示例7: newSiteCommand
/**
* Create a new site from a site template
*
* This command uses a site template located in a sitePackage to create a new site with a new subdomain.
*
* @param string $sitePackage Package key of the Site containing the template under Templates/Content/Sites.xml
* @param string $siteName The sitename
* @param string $baseDomain The base domain name e.g. site.com => will be used like $siteName.site.com
* @return void
*/
public function newSiteCommand($sitePackage, $siteName, $baseDomain)
{
try {
$site = $this->siteService->importSiteFromTemplate($sitePackage, $siteName, $baseDomain);
$this->outputLine('Created a new site "%s"', array($site->getName()));
} catch (\Exception $e) {
$this->systemLogger->logException($e);
$this->outputLine('An error occured during site creation, check error log for details');
}
}
示例8: handle
/**
* Renders the exception in HTML for display
*
* @param string $typoScriptPath path causing the exception
* @param \Exception $exception exception to handle
* @param integer $referenceCode
* @return string
*/
protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
{
$messageArray = array('header' => 'An exception was thrown while Neos tried to render your page', 'content' => $exception->getMessage(), 'stacktrace' => $this->formatTypoScriptPath($typoScriptPath), 'referenceCode' => $this->formatErrorCodeMessage($referenceCode));
$messageBody = sprintf('<p class="neos-message-content">%s</p>' . '<p class="neos-message-stacktrace"><code>%s</code></p>', $messageArray['content'], $messageArray['stacktrace']);
if ($referenceCode) {
$messageBody = sprintf('%s<p class="neos-reference-code">%s</p>', $messageBody, $messageArray['referenceCode']);
}
$message = sprintf('<div class="neos-message-header"><div class="neos-message-icon"><i class="icon-warning-sign"></i></div><h1>%s</h1></div>' . '<div class="neos-message-wrapper">%s</div>', $messageArray['header'], $messageBody);
$this->systemLogger->logException($exception);
return $message;
}
示例9: shutdownObject
/**
* Flush caches according to the previously registered node changes.
*
* @return void
*/
public function shutdownObject()
{
if ($this->tagsToFlush !== array()) {
foreach ($this->tagsToFlush as $tag => $logMessage) {
$affectedEntries = $this->contentCache->flushByTag($tag);
if ($affectedEntries > 0) {
$this->systemLogger->log(sprintf('Content cache: Removed %s entries %s', $affectedEntries, $logMessage), LOG_DEBUG);
}
}
}
}
示例10: removeAttendeeAction
/**
* @param string $event
* @param string $person
*
* @return void
*/
public function removeAttendeeAction($event, $person = '')
{
try {
$context = $this->contextFactory->create([]);
$person = $this->getPersonProfile($person, $context);
$event = $context->getNodeByIdentifier($event);
$this->eventService->removeAttendeeFromEvent($event, $person);
} catch (\Exception $exception) {
$this->systemLogger->log($exception->getMessage(), LOG_ALERT);
}
$this->addFlashMessage('Je bent afgemeld');
$this->redirectToUri('/agenda');
}
示例11: pingAction
/**
* @return void
*/
public function pingAction()
{
$this->systemLogger->log("FOO" . $this->apiKey);
$apiKey = $this->request->getHttpRequest()->getHeader('X-Api-Key');
$this->systemLogger->log($apiKey);
if ($apiKey === $this->apiKey) {
$this->response->setStatus(204);
$this->response->send();
} else {
$this->response->setStatus(403, 'Invalid Authentication');
$this->response->send();
}
return false;
}
示例12: initializeValue
/**
* @param string $value
* @throws Exception
* @throws \TYPO3\Flow\Resource\Exception
* @throws \TYPO3\Flow\Utility\Exception
*/
protected function initializeValue($value)
{
if (!is_array($value)) {
throw new Exception('Value must be an array, with source URI (sourceUri) and filename (filename)', 1425981082);
}
if (!isset($value['sourceUri'])) {
throw new Exception('Missing source URI', 1425981083);
}
$sourceUri = trim($value['sourceUri']);
if (!isset($value['filename'])) {
throw new Exception('Missing filename URI', 1425981084);
}
$filename = trim($value['filename']);
$overrideFilename = isset($value['overrideFilename']) ? trim($value['overrideFilename']) : $filename;
if (!isset($this->options['downloadDirectory'])) {
throw new Exception('Missing download directory data type option', 1425981085);
}
Files::createDirectoryRecursively($this->options['downloadDirectory']);
$temporaryFileAndPathname = trim($this->options['downloadDirectory'] . $filename);
$this->download($sourceUri, $temporaryFileAndPathname);
$sha1Hash = sha1_file($temporaryFileAndPathname);
# Try to add file extenstion if missing
if (!$this->downloadCache->has($sha1Hash)) {
$fileExtension = pathinfo($temporaryFileAndPathname, PATHINFO_EXTENSION);
if (trim($fileExtension) === '') {
$mimeTypeGuesser = new MimeTypeGuesser();
$mimeType = $mimeTypeGuesser->guess($temporaryFileAndPathname);
$this->logger->log(sprintf('Try to guess mime type for "%s" (%s), result: %s', $sourceUri, $filename, $mimeType), LOG_DEBUG);
$fileExtension = MediaTypes::getFilenameExtensionFromMediaType($mimeType);
if ($fileExtension !== '') {
$oldTemporaryDestination = $temporaryFileAndPathname;
$temporaryDestination = $temporaryFileAndPathname . '.' . $fileExtension;
copy($oldTemporaryDestination, $temporaryDestination);
$this->logger->log(sprintf('Rename "%s" to "%s"', $oldTemporaryDestination, $temporaryDestination), LOG_DEBUG);
}
}
}
$resource = $this->resourceManager->getResourceBySha1($sha1Hash);
if ($resource === NULL) {
$resource = $this->resourceManager->importResource($temporaryFileAndPathname);
if ($filename !== $overrideFilename) {
$resource->setFilename($overrideFilename);
}
}
$this->temporaryFileAndPathname = $temporaryFileAndPathname;
$this->downloadCache->set($sha1Hash, ['sha1Hash' => $sha1Hash, 'filename' => $filename, 'sourceUri' => $sourceUri, 'temporaryFileAndPathname' => $temporaryFileAndPathname]);
$this->value = $resource;
}
示例13: getResponseFromCache
/**
* @Flow\Around("setting(Ttree.Embedly.logApiRequest) && within(Ttree\Embedly\Embedly) && method(public .*->(oembed|preview|objectify|extract|services)())")
* @param JoinPointInterface $joinPoint The current join point
* @return mixed
*/
public function getResponseFromCache(JoinPointInterface $joinPoint)
{
$proxy = $joinPoint->getProxy();
$key = ObjectAccess::getProperty($proxy, 'key');
$params = $joinPoint->getMethodArgument('params');
$cacheKey = md5($joinPoint->getClassName() . $joinPoint->getMethodName() . $key . json_encode($params));
if ($this->responseCache->has($cacheKey)) {
$this->systemLogger->log(sprintf(' cache hit Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
return $this->responseCache->get($cacheKey);
} else {
$this->systemLogger->log(sprintf(' cache miss Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
}
$response = $joinPoint->getAdviceChain()->proceed($joinPoint);
$this->responseCache->set($cacheKey, $response);
return $response;
}
示例14: detectChanges
/**
* Detects changes of the files and directories to be monitored and emits signals
* accordingly.
*
* @return void
* @api
*/
public function detectChanges()
{
if ($this->changedFiles === null || $this->changedPaths === null) {
$this->loadDetectedDirectoriesAndFiles();
$changesDetected = false;
$this->changedPaths = $this->changedFiles = array();
$this->changedFiles = $this->detectChangedFiles($this->monitoredFiles);
foreach ($this->monitoredDirectories as $path => $filenamePattern) {
$changesDetected = $this->detectChangesOnPath($path, $filenamePattern) ? true : $changesDetected;
}
if ($changesDetected) {
$this->saveDetectedDirectoriesAndFiles();
}
$this->directoriesAndFiles = null;
}
$changedFileCount = count($this->changedFiles);
$changedPathCount = count($this->changedPaths);
if ($changedFileCount > 0) {
$this->emitFilesHaveChanged($this->identifier, $this->changedFiles);
}
if ($changedPathCount > 0) {
$this->emitDirectoriesHaveChanged($this->identifier, $this->changedPaths);
}
if ($changedFileCount > 0 || $changedPathCount) {
$this->systemLogger->log(sprintf('File Monitor "%s" detected %s changed files and %s changed directories.', $this->identifier, $changedFileCount, $changedPathCount), LOG_INFO);
}
}
示例15: logDeprecation
/**
* Log a deprecation message once
*
* @return void
*/
protected function logDeprecation()
{
if (!static::$loggedDeprecation) {
static::$loggedDeprecation = true;
$this->logger->log('TYPO3.Media is configured to simulate the deprecated Neos 1.2 behaviour. Please check the setting "TYPO3.Media.behaviourFlag".', LOG_DEBUG);
}
}