( eventName: string, // intentionally no strings, to avoid accidentally logging code/filepaths metadata: LogEventMetadata, )
| 156 | * If no sink is attached, events are queued and drained when the sink attaches. |
| 157 | */ |
| 158 | export async function logEventAsync( |
| 159 | eventName: string, |
| 160 | // intentionally no strings, to avoid accidentally logging code/filepaths |
| 161 | metadata: LogEventMetadata, |
| 162 | ): Promise<void> { |
| 163 | const canonicalEventName = toCanonicalAnalyticsName(eventName) |
| 164 | if (sink === null) { |
| 165 | eventQueue.push({ eventName: canonicalEventName, metadata, async: true }) |
| 166 | return |
| 167 | } |
| 168 | await sink.logEventAsync(canonicalEventName, metadata) |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Reset analytics state for testing purposes only. |
nothing calls this directly
no test coverage detected