import { r360IntegrationApiKey, r360IntegrationApiUrl } from '../config/common';
import { sendHttpRequestAxios } from './http-axios-request';

async function sendLogsToR360Logger(logPayload: any) {
  try {
    await sendHttpRequestAxios({
      url: `${r360IntegrationApiUrl}/r360-logger/log`,
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': r360IntegrationApiKey,
      },
      data: logPayload,
    });
  } catch (err) {
    console.error('[Logger] Failed to send log to queue:', err?.message || err);
  }
}
export default sendLogsToR360Logger;
