> ## Documentation Index
> Fetch the complete documentation index at: https://doc-dev.weir.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Log Entry

> Create a new log entry

# Create Log Entry

Create a new log entry in the system logging service.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.weir.ai/logs/log?scheme=admin' \
    -H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
      "type": "INFO",
      "message": "System operation completed",
      "dateTime": "2024-01-22T15:30:00.000Z"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "data": {
      "logId": "log_123456789",
      "type": "INFO",
      "message": "System operation completed",
      "timestamp": "2024-01-22T15:30:00Z"
    },
    "message": "Log entry created successfully",
    "status": "success"
  }
  ```
</ResponseExample>

## Query Parameters

<ParamField query="scheme" type="string" required>
  Log scheme type (admin, console, external).
</ParamField>

## Request Body

<ParamField body="type" type="string" required>
  Log type (INFO, WARNING, ERROR, DEBUG).
</ParamField>

<ParamField body="message" type="string" required>
  Log message content.
</ParamField>

<ParamField body="dateTime" type="string" required>
  ISO 8601 formatted timestamp.
</ParamField>

## Usage Examples

<CodeGroup>
  ```javascript JavaScript theme={null}
  const createLog = async (logData, scheme, accessToken) => {
    const response = await fetch(`https://api.weir.ai/logs/log?scheme=${scheme}`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(logData)
    });
    if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
    return await response.json();
  };
  ```

  ```python Python theme={null}
  import requests
  from datetime import datetime

  def create_log(log_data, scheme, access_token):
      response = requests.post(
          f'https://api.weir.ai/logs/log?scheme={scheme}',
          headers={
              'Authorization': f'Bearer {access_token}',
              'Content-Type': 'application/json'
          },
          json=log_data
      )
      response.raise_for_status()
      return response.json()

  # Usage
  log_entry = create_log({
      'type': 'INFO',
      'message': 'System operation completed',
      'dateTime': datetime.now().isoformat() + 'Z'
  }, 'admin', 'your_access_token')
  ```
</CodeGroup>
