()
| 100 | let datadogInitialized: boolean | null = null |
| 101 | |
| 102 | async function flushLogs(): Promise<void> { |
| 103 | if (logBatch.length === 0) return |
| 104 | |
| 105 | const logsToSend = logBatch |
| 106 | logBatch = [] |
| 107 | |
| 108 | try { |
| 109 | await axios.post(DATADOG_LOGS_ENDPOINT, logsToSend, { |
| 110 | headers: { |
| 111 | 'Content-Type': 'application/json', |
| 112 | 'DD-API-KEY': DATADOG_CLIENT_TOKEN, |
| 113 | }, |
| 114 | timeout: NETWORK_TIMEOUT_MS, |
| 115 | }) |
| 116 | } catch (error) { |
| 117 | logError(error) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | function scheduleFlush(): void { |
| 122 | if (flushTimer) return |
no test coverage detected