Skip to main content

Insert Log

The insertLog() method on the LMChatClient allows you to save a log in the local database i.e Realm which could later be retrieved.

Steps To Insert Log

  1. To store a log, use the insertLog() method on the LMChatClient instance.
  2. Pass the required parameters: timestamp, stackTrace, sdkMeta, and severity.
  3. The log is saved in the Realm database and can be retrieved later using getLogs().

Example Usage

const logEntry = {
timestamp: Date.now(),
stackTrace: { exception: "Error message", trace: "Stack trace details" },
sdkMeta: { coreVersion: "1.0.0", dataLayerVersion: "2.1.0" },
severity: LMSeverity.ERROR,
};

await lmChatClient?.insertLog(logEntry);

Insert Log Parameters

VariableTypeDescription
timestampnumberThe time when the log was created.
stackTraceLMStackTraceContains exception and trace details.
sdkMetaLMSDKMetaContains SDK version details (coreVersion, dataLayerVersion).
severitynumberThe severity level of the log (INFO, ERROR, etc.).