Skip to main content
GET
https://api-dev.weir.ai/
/
logs
/
all
curl -X GET 'https://api.weir.ai/logs/all?type=ERROR&scheme=admin&page=1&limit=10&startDate=2024-01-01&endDate=2024-01-31' \
  -H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN'
{
  "data": {
    "logs": [
      {
        "logId": "log_123456789",
        "type": "ERROR",
        "message": "Database connection failed",
        "timestamp": "2024-01-22T15:30:00Z",
        "scheme": "admin",
        "severity": "high",
        "metadata": {
          "source": "database",
          "retryAttempts": 3
        }
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 150,
      "totalPages": 15
    }
  },
  "message": "Logs retrieved successfully",
  "status": "success"
}

Get All Log Entries

Retrieve all log entries from the system with optional filtering.
curl -X GET 'https://api.weir.ai/logs/all?type=ERROR&scheme=admin&page=1&limit=10&startDate=2024-01-01&endDate=2024-01-31' \
  -H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN'
{
  "data": {
    "logs": [
      {
        "logId": "log_123456789",
        "type": "ERROR",
        "message": "Database connection failed",
        "timestamp": "2024-01-22T15:30:00Z",
        "scheme": "admin",
        "severity": "high",
        "metadata": {
          "source": "database",
          "retryAttempts": 3
        }
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 150,
      "totalPages": 15
    }
  },
  "message": "Logs retrieved successfully",
  "status": "success"
}

Query Parameters

type
string
Log type filter (INFO, WARNING, ERROR, DEBUG).
scheme
string
required
Log scheme (admin, console, external).
page
integer
default:"1"
Page number for pagination.
limit
integer
default:"10"
Number of logs per page (1-100).
startDate
string
Start date in ISO format (YYYY-MM-DD).
endDate
string
End date in ISO format (YYYY-MM-DD).

Response Fields

data.logs
array
required
Array of log entry objects.

Usage Examples

const getAllLogs = async (filters, accessToken) => {
  const params = new URLSearchParams(filters);
  const response = await fetch(`https://api.weir.ai/logs/all?${params}`, {
    headers: { 'Authorization': `Bearer ${accessToken}` }
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};

// Usage
const logs = await getAllLogs({
  type: 'ERROR',
  scheme: 'admin',
  page: 1,
  limit: 50,
  startDate: '2024-01-01',
  endDate: '2024-01-31'
}, 'your_access_token');

Log Types

Informational messages about normal system operations.
Warning messages about potentially problematic situations.
Error messages about failures and exceptions.
Detailed debugging information for development.

Best Practices

Filter by Date Range

Use startDate and endDate to limit results to relevant time periods.

Use Appropriate Page Size

Use reasonable page sizes (10-50) for better performance.

Filter by Type

Filter by log type to focus on specific issues (e.g., only ERRORs).

Monitor Regularly

Regularly review logs for system health and security monitoring.
Pro Tip: Use ERROR and WARNING filters to quickly identify and address system issues. Set up automated monitoring for critical log types.