Skip to main content

Push Logs

The pushLogs() function is used to push logs. It takes a PushLogRequest as input, which includes a list of LMLog objects. The function returns a PushLogResponse as a Future.

Steps to Push Logs with Error Logging

  1. Create an instance of PushLogRequest with the required parameter: logs (a list of LMLog objects).
  2. Call the pushLogs() function using the instance of the LMLog class, passing the request as a parameter.
  3. Use the response as per your requirement.
// Create an instance of PushLogRequest
final PushLogRequest pushLogRequest = PushLogRequest(
logs: [
LMLog(...),
// Add more LMLog objects as needed
],
);

// Get the response from calling the function
final PushLogResponse pushLogResponse = await lmLog.pushLogs(pushLogRequest);

// Process the response, as per requirement
if (pushLogResponse.success) {
// your function to handle successful log push
handleLogPushSuccess();
} else {
// your function to handle error message
handleLogPushError(pushLogResponse.errorMessage);
}

Models

PushLogRequest

List of parameters for the PushLogRequest class

VariableTypeDescriptionOptional
logsList<LMLog>List of log objects to be pushed

PushLogResponse

List of parameters for the PushLogResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure