示例#1
0
 /**
  * Logs the request info to the Logger::$REQUEST_INFO_LOG log the request has transformed
  * by PrepareRequest() and both the request has been sanitized by RemoveSensitiveInfo().
  *
  * @param string $level the log level to use
  * @see PrepareRequest()
  * @see RemoveSensitiveInfo()
  */
 private function LogRequestInfo($level)
 {
     $message = $this->GenerateRequestInfoMessage($this->lastRequest, $this->lastResponse, $this->lastSoapFault);
     Logger::log(Logger::$REQUEST_INFO_LOG, $message, $level);
 }
示例#2
0
文件: AdsUser.php 项目: Katoga/g-ads
 /**
  * Configures the library to log all requests.
  */
 public function LogAll()
 {
     Logger::SetLogLevel(Logger::$SOAP_XML_LOG, Logger::$INFO);
     Logger::SetLogLevel(Logger::$REQUEST_INFO_LOG, Logger::$INFO);
 }
示例#3
0
 /**
  * Log messages to the relevant message sources.
  *
  * @param string $message is the message to log
  * @param string $level is the message level to log
  */
 protected static function Log($message, $level = null)
 {
     Logger::log(Logger::$SOAP_XML_LOG, $message, $level);
     Logger::log(Logger::$REQUEST_INFO_LOG, $message, $level);
 }
示例#4
0
 /**
  * Overrides AdsUser::LogAll(), setting an additional log level for report download requests.
  */
 public function LogAll()
 {
     parent::LogAll();
     Logger::SetLogLevel(ReportUtils::$LOG_NAME, Logger::$INFO);
 }
示例#5
0
文件: Report.php 项目: Katoga/g-ads
 /**
  * Logs the report download request.
  *
  * @param string $requestHeaders the HTTP request headers
  * @param integer $responseCode the HTTP response code
  * @param array $params the parameters that were sent, if any
  * @param Exception $exception the exception that will be thrown, if any
  */
 private static function LogRequest($requestHeaders, $responseCode, $params = null, $exception = null)
 {
     $level = isset($exception) ? Logger::$ERROR : Logger::$INFO;
     $messageParts = array();
     $messageParts[] = trim($requestHeaders);
     $messageParts[] = '';
     // Blank line for readability.
     $messageParts[] = "Parameters:";
     foreach ($params as $name => $value) {
         $messageParts[] = sprintf('%s: %s', $name, $value);
     }
     $messageParts[] = '';
     // Blank line for readability.
     $messageParts[] = sprintf('Response Code: %s', $responseCode);
     if (isset($exception)) {
         $messageParts[] = sprintf('Error Message: %s', $exception->GetMessage());
     }
     $messageParts[] = '';
     // Blank line for readability.
     $message = implode("\n", $messageParts);
     Logger::Log(self::$LOG_NAME, $message, $level);
 }