# 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
```
