(message: string, data: Record<string, unknown>)
| 86 | } |
| 87 | |
| 88 | function logAnalyticsDebug(message: string, data: Record<string, unknown>) { |
| 89 | if (!DEBUG_ANALYTICS) { |
| 90 | return |
| 91 | } |
| 92 | loadLogger() |
| 93 | .then(({ logger }) => { |
| 94 | logger.debug(data, message) |
| 95 | }) |
| 96 | .catch((error) => { |
| 97 | try { |
| 98 | console.debug(message, data) |
| 99 | } catch { |
| 100 | // Ignore console errors in restricted environments |
| 101 | } |
| 102 | // Log the error to help diagnose logger issues in debug mode |
| 103 | console.debug('Failed to load logger for analytics:', error) |
| 104 | }) |
| 105 | } |
| 106 | |
| 107 | /** Get current distinct ID (real user ID if identified, otherwise anonymous ID) */ |
| 108 | function getDistinctId(): string | undefined { |
no test coverage detected