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
- To store a log, use the
insertLog()
method on the LMChatClient instance. - Pass the required parameters:
timestamp
,stackTrace
,sdkMeta
, andseverity
. - 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
Variable | Type | Description |
---|---|---|
timestamp | number | The time when the log was created. |
stackTrace | LMStackTrace | Contains exception and trace details. |
sdkMeta | LMSDKMeta | Contains SDK version details (coreVersion , dataLayerVersion ). |
severity | number | The severity level of the log (INFO, ERROR, etc.). |