Logging
The SDK has no verbose mode, and there is nothing to turn on. On Android it logs one line when the configuration has loaded; otherwise it writes a line only when something needs your attention.
On Android, look in Logcat for the tags SirDataCMP and SirDataCMPManager:
the publisher configuration loaded (
Config loaded successfully), or failed to load, with the reason (Config load failed: …), both on theSirDataCMPManagertag;a consent submission that failed (
Consent submission failed: …);TC string generation failed: /consent-string …: despite its wording, the server archive of a recorded choice failed. The TC string itself is encoded on the device and stored. The line is written when the next choice is recorded;getLastTcStringError()returns the same message;a stored TC string that could not be read back;
a consent adapter that failed to forward a choice, under the adapter's name;
a call to
initialize,shutdownorsetCcpaOptOutmade off the main thread.
The configuration failure can also be read in code: SirDataCMPApi.getInitError() is a StateFlow<String?> — null while the configuration loads and after it loaded, the error message once a load has failed. The next initialize clears it.
lifecycleScope.launch {
SirDataCMPApi.getInitError().collect { error ->
if (error != null) Log.w("CMP", "Configuration failed to load: $error")
}
}On iOS, look in the Xcode console for lines starting with [CMP]: the same adapter failures, main-thread violations and unreadable stored TC string, plus a TCF or GPP command called off the main thread. An initialization failure is not logged on iOS: read it with IosCMPApi.shared.getInitError() — nil while the configuration loads and after it loaded, the error message once a load has failed — once getConsentState() has left LOADING. In 2.0.0 the SDK sets it on the main thread just after that change, so it may still be nil at the very moment the state turns READY; the next release sets it before.
debugMode
debugMode does not change what is logged. It makes a call to initialize, shutdown or setCcpaOptOut made off the main thread throw instead of only being logged, so the fault surfaces in your own debug build. Enable it in debug builds only: the SDK does not check the build type, and on iOS the exception terminates the app.
React Native: do not pass debugMode: true on Android in 2.0.0 and 2.0.1. The bridge calls initialize off the main thread, so with debugMode the promise rejects with E_INIT — see Troubleshooting. See also Setup — React Native.
Reading the display decision
If the banner does not show, the decision object says why before any log does:
An active capping window, a stored consent that still covers every active purpose, or GDPR not applying are all normal reasons for a banner not to appear.
Never log consent as user data
The TC string and the per-purpose bit fields describe an identified user's choices. They belong in debug logs during development, not in a production crash reporter or analytics event.
Mis à jour
Ce contenu vous a-t-il été utile ?
