( eventName: string, // intentionally no strings, to avoid accidentally logging code/filepaths metadata: LogEventMetadata, )
| 152 | * If no sink is attached, events are queued and drained when the sink attaches. |
| 153 | */ |
| 154 | export async function logEventAsync( |
| 155 | eventName: string, |
| 156 | // intentionally no strings, to avoid accidentally logging code/filepaths |
| 157 | metadata: LogEventMetadata, |
| 158 | ): Promise<void> { |
| 159 | if (sink === null) { |
| 160 | eventQueue.push({ eventName, metadata, async: true }) |
| 161 | return |
| 162 | } |
| 163 | await sink.logEventAsync(eventName, metadata) |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Reset analytics state for testing purposes only. |