示例#1
0
 /**
  * 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);
 }
示例#2
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);
 }
示例#3
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()
  * @access private
  */
 private function LogRequestInfo($level)
 {
     $message = $this->GenerateRequestInfoMessage($this->lastRequest, $this->lastResponse, $this->lastSoapFault);
     Logger::log(Logger::$REQUEST_INFO_LOG, $message, $level);
 }
示例#4
0
 /**
  * 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);
 }