Use the SDK to create and save diagnostic logs
You can use our SDK in the managed package to generate diagnostic logs in Salesforce. The SDK uses the Salesforce Apex programming language.
Access our SDK through the Logger class under the purecloud.SDK.Logger namespace.
Contains methods that allow you to create and save diagnostic logs through Genesys Cloud for Salesforce.
Use these methods to create pending log requests and then save the logs at the end of a transaction through Genesys Cloud for Salesforce.
The following methods are available for the Logger class.
Creates a pending log stored in memory for your Salesforce organization.
|name||String||Name of the log that you want to appear in your Salesforce organization.|
|message||String||Message that you want to appear in the log.|
Log level for the logs that you want to create.
Valid values: ERROR, WARN, INFO, DEBUG.
This log level must match or be lower than the log level that you set in Salesforce. For example, if you set Logging to WARN in the call center settings, then you must pass ERROR or WARN into logLevel in your Apex code; if you pass INFO or DEBUG, then the integration will not create logs. For more information, see Diagnostic logs in Salesforce.
The following example creates a pending log in memory. The log request is called SDK, generates a message, and generates the most detailed amount of information (DEBUG).
purecloud.SDK.Logger.createPendingLog('SDK', 'I am a diagnostic log message!', purecloud.Log.LogLevels.DEBUG);
Saves pending logs stored in memory to your Salesforce organization. Uses DML to insert logs into Genesys Cloud_Log__c records.
The saved logs appear on the Genesys Cloud Logs page in Salesforce. For more information, see Diagnostic logs in Salesforce.
The following example saves pending logs that were stored in memory with the createPendingLogs method.
For more information, see SDK in Genesys Cloud for Salesforce.
For more information about the integration, see About Genesys Cloud for Salesforce.