Requests, responses, and summary messages made to the Google Ads API can be
logged with your own custom logger or the default logger in the client library
for Perl.

## Log levels

The library logs different types of events to different log levels. On a
successful API response, the summary is logged at `INFO`, and the full
request and response are logged at `DEBUG`. On a request that results in
an API error, the summary message is logged at `WARN` and the full request
and response are logged at `INFO`.

| Log type | Log name | Success level | Failure level |
|---|---|---|---|
| SUMMARY | Google.Ads.GoogleAds.Summary | INFO | WARN |
| DETAIL | Google.Ads.GoogleAds.Detail | DEBUG | INFO |

For partial failures, the partial failure details are logged to the `DETAIL`
logger at `DEBUG`.

## Configuration

The client library uses a custom class for all logging purposes and is exposed
through the [`GoogleAdsLogger`](https://github.com/googleads/google-ads-perl/blob/HEAD/lib/Google/Ads/GoogleAds/Logging/GoogleAdsLogger.pm) module. This class provides a
default configuration where both summary and detail loggers write to files in
the `logs` folder under your `HOME` directory.

### Customize Log4perl configuration

You can override the default configuration by providing a custom
[`log4perl.conf`](https://github.com/googleads/google-ads-perl/blob/HEAD/log4perl.conf) file in your `HOME` directory, or by
initializing `Log::Log4perl` directly in your application before making API
calls.

### Enable or disable logs

Logging can be enabled or disabled programmatically using the following helper
methods:

- Enable logging for both loggers (pass `1` to set the level to `DEBUG` so
  full request and response payloads are logged for successful calls):

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

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

- Disable all logging:

      Google::Ads::GoogleAds::Logging::GoogleAdsLogger::disable_all_logging();

- Disable summary logging:

      Google::Ads::GoogleAds::Logging::GoogleAdsLogger::disable_summary_logging();

- Disable detail logging:

      Google::Ads::GoogleAds::Logging::GoogleAdsLogger::disable_detail_logging();

You can use the methods of the `GoogleAdsLogger` class directly for even more
control over how requests are logged.