Log level
Control how much information the Adtrace Web SDK writes to the browser console. Set logLevel in Adtrace.initSdk before the SDK starts.
Parameter
Pass logLevel in your initSdk options object. See Configuration for the full init example.
| Parameter | Type | Description |
|---|---|---|
logLevel | string | Console verbosity. Default is error. |
Available log levels
| Level | Description |
|---|---|
verbose | Detailed messages for every action. Recommended while testing. |
info | Basic info, warnings, and errors |
warning | Warnings and errors only |
error | Errors only (default) |
none | No console output |
Example
Adtrace.initSdk({
appToken: '{YourAppToken}',
environment: 'sandbox',
logLevel: 'verbose',
});
On-screen log output (testing)
For mobile browser testing, you can render logs in an HTML container by passing logOutput with the element ID:
| Parameter | Type | Description |
|---|---|---|
logOutput | string | ID of an HTML element where logs should appear. Use only for testing. |
Adtrace.initSdk({
appToken: '{YourAppToken}',
environment: 'sandbox',
logLevel: 'verbose',
logOutput: 'adtrace-log-container',
});
<div id="adtrace-log-container"></div>
Production recommendation
Use error or none with environment: 'production' before you ship.