Skip to main content

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.

ParameterTypeDescription
logLevelstringConsole verbosity. Default is error.

Available log levels

LevelDescription
verboseDetailed messages for every action. Recommended while testing.
infoBasic info, warnings, and errors
warningWarnings and errors only
errorErrors only (default)
noneNo 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:

ParameterTypeDescription
logOutputstringID 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.