> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/ios-sdk/debugging.md).

# 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](https://docs.verygoodsecurity.com/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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
