# Logging

AppConsentUnified relies on `os_log` as recommended by Apple to log informational or debug messages. Our approach is to rely on Apple’s unified logging systems mechanisms, so the log level is configured by default at runtime.

### Overview <a href="#overview" id="overview"></a>

You can view log messages using the `Console` app, `log` command line tool, or XCode debug console.

AppConsentUnified debug messages are logged for subsystem `io.sfbx.appconsent` and category can be `AppConsentUnified`.

Below is a summary of some command examples using `log` that could be useful to setup logging preferences on your development environment.

* on your development Mac:
  * to check the current log config: `sudo log config --status --subsystem io.sfbx.appconsent`
  * to change the logging behavior: `sudo log config --mode "level:off" --subsystem io.sfbx.appconsent`
* in XCode simulator:
  * to check the current log config: `xcrun simctl spawn booted log config --status --subsystem io.sfbx.appconsent`

    to change the logging behavior: `xcrun simctl spawn booted log config --mode "level:off" --subsystem io.sfbx.appconsent`
  * the `--mode` option takes the following arguments (taken from `log` manual pages):

```
Modes can be specified as a comma-separated list of key:value pairs.

Valid keys and their values are:
level             off | default | info | debug
persist           off | default | info | debug
stream            live | default
```


---

# 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.sfbx.io/configuration/step-3-notice-implementation-web-app-tv/ios/appconsent-unified-sdk/go-further/logging.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.
