當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ILogger::log方法代碼示例

本文整理匯總了PHP中OCP\ILogger::log方法的典型用法代碼示例。如果您正苦於以下問題:PHP ILogger::log方法的具體用法?PHP ILogger::log怎麽用?PHP ILogger::log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCP\ILogger的用法示例。


在下文中一共展示了ILogger::log方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logException

 /**
  * Log exception
  *
  */
 public function logException(\Exception $ex)
 {
     $exceptionClass = get_class($ex);
     $level = \OCP\Util::FATAL;
     if (isset($this->nonFatalExceptions[$exceptionClass])) {
         $level = \OCP\Util::DEBUG;
     }
     $message = $ex->getMessage();
     if ($ex instanceof Exception) {
         if (empty($message)) {
             $response = new Response($ex->getHTTPCode());
             $message = $response->getStatusText();
         }
         $message = "HTTP/1.1 {$ex->getHTTPCode()} {$message}";
     }
     $exception = ['Message' => $message, 'Code' => $ex->getCode(), 'Trace' => $ex->getTraceAsString(), 'File' => $ex->getFile(), 'Line' => $ex->getLine()];
     $this->logger->log($level, 'Exception: ' . json_encode($exception), ['app' => $this->appName]);
 }
開發者ID:samj1912,項目名稱:repo,代碼行數:22,代碼來源:exceptionloggerplugin.php

示例2: getSharedSecret

 /**
  * create shared secret and return it
  *
  * @return \OC_OCS_Result
  */
 public function getSharedSecret()
 {
     $url = $this->request->getParam('url');
     $token = $this->request->getParam('token');
     if ($this->trustedServers->isTrustedServer($url) === false) {
         $this->logger->log(\OCP\Util::ERROR, 'remote server not trusted (' . $url . ') while getting shared secret');
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     if ($this->isValidToken($url, $token) === false) {
         $this->logger->log(\OCP\Util::ERROR, 'remote server (' . $url . ') didn\'t send a valid token (got ' . $token . ') while getting shared secret');
         return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
     }
     $sharedSecret = $this->secureRandom->generate(32);
     $this->trustedServers->addSharedSecret($url, $sharedSecret);
     // reset token after the exchange of the shared secret was successful
     $this->dbHandler->addToken($url, '');
     return new \OC_OCS_Result(['sharedSecret' => $sharedSecret], Http::STATUS_OK);
 }
開發者ID:kenwi,項目名稱:core,代碼行數:23,代碼來源:ocsauthapi.php

示例3: log

 /**
  * @inheritdoc
  */
 public function log($level, $message, array $context = array())
 {
     $this->logger->log($level, $message, array_merge($this->context, $context));
 }
開發者ID:matiasdelellis,項目名稱:mail,代碼行數:7,代碼來源:logger.php

示例4: log

 private function log($level, $message, $params)
 {
     $msg = vsprintf($message, $params);
     $this->logger->log($level, $msg, ['app' => $this->loggerName]);
 }
開發者ID:pigulla,項目名稱:owncloud-sipgate,代碼行數:5,代碼來源:applogger.php


注:本文中的OCP\ILogger::log方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。