# Debugging

`VGSCollectSDK` provides customizable configuration to debug and log potential issues. By default all logging options are disabled.

`VGSCollectSDK` only prints formatted logs to your console. It does not record your activity to some persistent storage, local file, also we do not send your logging activity to any server.

You can turn on logging warnings and erros by changing `VGSCollectLogger.shared` instance `configuration.level` property. You can also turn on `isNetworkDebugEnabled` property for logging `VGSCollectSDK` network requests to verify whether request was successfull or failed.

```swift
// Log only warnings and errors.
VGSCollectLogger.shared.configuration.level = .warning

// Log network requests.
VGSCollectLogger.shared.configuration.isNetworkDebugEnabled = true
```

> You may always debug your setup with [Access Logger](/vault/http-proxy/access-logger.md), by seeing requests statuses, payload diffs, matched information etc.

## Log levels

`VGSCollectSDK` provides the following log levels:

* **info**. Log *all* events including errors and warnings.
* **warning**. Log *only* events indicating warnings and errors.
* **none**. Log *no* events. Default setting.

```swift
/// Defines levels of logging.
public enum VGSLogLevel: String {
	/// Log *all* events including errors and warnings.
	case info

	/// Log *only* events indicating warnings and errors.
	case warning

	/// Log *no* events.
	case none
}
```

## Disable logging

To disable all logging activities you can use `disableAllLoggers()` method of `VGSCollectLogger.shared` instance. It will set log level to `.none` and stop network debugging.

```swift
if MyApp.shared.configuration == .prod {
    // Disable all loggers for your prod configuration and live apps.
	VGSCollectLogger.shared.disableAllLoggers()
}
```

> You should NOT use logging in your production configurations for live applications.\\

## Extensive logging

For extensive debugging and logging you can set log level to `.info` and `.isExtensiveDebugEnabled` option to `true`. You can turn on `.isExtensiveDebugEnabled` option for more verbose logs like file name, function name and line number where event was trigerred.

```swift
// Log all events.
VGSCollectLogger.shared.configuration.level = .info

// Log network requests.
VGSCollectLogger.shared.configuration.isNetworkDebugEnabled = true

// Add verbose information to logs.
VGSCollectLogger.shared.configuration.isExtensiveDebugEnabled = true
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/ios-sdk/debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
