Edit in GitHubLog an issue

Logger

Description#

When initializing the SDK, the options.logger object is an optional object. However, in order to debug effectively when an issue occurs, a logger object should be provided when initializing the SDK.

The logger object is expected to have a debug() and an error() method. When an appropriate logger is provided, such as console, Target requests and responses will be logged.

Example#

Copied to your clipboard
1const TargetClient = require("@adobe/target-nodejs-sdk");
2const CONFIG = {
3 client: "acmeclient",
4 organizationId: "1234567890@AdobeOrg",
5 logger: console
6};
7
8const targetClient = TargetClient.create(CONFIG);
9
10const request = {
11 execute: {
12 mboxes: [{
13 name: "a1-serverside-ab",
14 index: 1
15 }]
16 }
17};
18
19const response = await targetClient.getOffers({ request, targetCookie });

You should see requests and responses being printed in the console.

Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.