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
- Create an instance of
PushLogRequest
with the required parameter:logs
(a list ofLMLog
objects). - Call the
pushLogs()
function using the instance of theLMLog
class, passing the request as a parameter. - 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
Variable | Type | Description | Optional |
---|---|---|---|
logs | List<LMLog > | List of log objects to be pushed |
PushLogResponse
List of parameters for the PushLogResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in case of failure | ✔ |