(client: Client, maybeLogBuffer?: Array<SerializedLog>)
| 187 | * the stable Sentry SDK API and can be changed or removed without warning. |
| 188 | */ |
| 189 | export function _INTERNAL_flushLogsBuffer(client: Client, maybeLogBuffer?: Array<SerializedLog>): void { |
| 190 | const logBuffer = maybeLogBuffer ?? _INTERNAL_getLogBuffer(client) ?? []; |
| 191 | if (logBuffer.length === 0) { |
| 192 | return; |
| 193 | } |
| 194 | |
| 195 | const clientOptions = client.getOptions(); |
| 196 | const envelope = createLogEnvelope( |
| 197 | logBuffer, |
| 198 | clientOptions._metadata, |
| 199 | clientOptions.tunnel, |
| 200 | client.getDsn(), |
| 201 | client.getDataCollectionOptions().userInfo, |
| 202 | ); |
| 203 | |
| 204 | // Clear the log buffer after envelopes have been constructed. |
| 205 | _getBufferMap().set(client, []); |
| 206 | |
| 207 | client.emit('flushLogs'); |
| 208 | |
| 209 | // sendEnvelope should not throw |
| 210 | // eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 211 | client.sendEnvelope(envelope); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Returns the log buffer for a given client. |
no test coverage detected