NAME

Google::Ads::GoogleAds::Logging::GoogleAdsLogger

SYNOPSIS

use Google::Ads::GoogleAds::Logging::GoogleAdsLogger;

Google::Ads::GoogleAds::Logging::GoogleAdsLogger::enable_all_logging(1);

Google::Ads::GoogleAds::Logging::GoogleAdsLogger::log_summary($http_request, $http_response);

Google::Ads::GoogleAds::Logging::GoogleAdsLogger::log_detail($http_request, $http_response);

DESCRIPTION

This class allows logging of outgoing and incoming REST messages as executed API calls. It initializes the loggers based on a provided log4perl.conf file or default parameters if the file is not found. It contains methods to retrieve the summary and detail loggers.

METHODS

initialize_logging

Initializes the loggers based on the default log4perl.conf file or default parameters if the file is not found.

enable_summary_logging

Enables the logging for the one-line summary.

Parameters

A boolean value of whether to include the DEBUG level messages.

disable_summary_logging

Disables the one-line summary logging.

enable_detail_logging

Enables the logging for traffic detail of HTTP request and response.

Parameters

A boolean value of whether to include the DEBUG level messages.

disable_detail_logging

Disables the traffic detail logging.

enable_all_logging

Enables all logging for the one-line summary and the traffic detail.

Parameters

A boolean value of whether to include the DEBUG level messages.

disable_all_logging

Stops all logging.

get_summary_logger

Retrieves the summary logger used to log the one-line summary.

Returns

A Log::Log4perl logger for the one-line summary.

get_detail_logger

Retrieves the detail logger used to log the traffic detail.

Returns

A Log::Log4perl logger for the traffic detail.

log_summary

Logs a one-line summary for each REST API request.

Parameters

  • http_request: The REST HTTP request sent to Google Ads API server.

  • http_response: The HTTP response received from Google Ads API server.

log_detail

Full log of the traffic detail about the request/response payload.

Parameters

  • http_request: The REST HTTP request sent to Google Ads API server.

  • http_response: The HTTP response received from Google Ads API server.

__parse_host

The private method to parse the hostname from a HTTP request.

Parameters

  • http_request: The REST HTTP request sent to Google Ads API server.

Returns

The parsed hostname in the format of <scheme>://<domain>.

__parse_fault_message

The private method to parse the fault message from the HTTP response, if an error has occurred at the server side. This message can be used to construct a Google::Ads::GoogleAds::Logging::SummaryStats.

__parse_faults

The private method to parse all the faults from the HTTP response, and encode them in the JSON format. These faults will be used to construct a Google::Ads::GoogleAds::Logging::DetailStats.

LICENSE AND COPYRIGHT

Copyright 2019 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

REPOSITORY INFORMATION

$Rev: $
$LastChangedBy: $
$Id: $