Colocate bitdrift in logger, use logger for transport (#7868)

* Colocate bitdrift in logger, use logger for transport

(cherry picked from commit cdd6941fd7)

* Fix mocks, format

(cherry picked from commit 9de88660c6)

* Ok I guess mocks dir doesn't work

(cherry picked from commit 9f37e52011)
This commit is contained in:
Eric Bailey
2025-02-28 12:46:27 -06:00
committed by GitHub
parent 7c36ea1158
commit 36a7a8d8c6
9 changed files with 15 additions and 23 deletions
+1 -6
View File
@@ -4,7 +4,6 @@ import {AppState, AppStateStatus} from 'react-native'
import {Statsig, StatsigProvider} from 'statsig-react-native-expo'
import {BUNDLE_DATE, BUNDLE_IDENTIFIER, IS_TESTFLIGHT} from '#/lib/app-info'
import * as bitdrift from '#/lib/bitdrift'
import {logger} from '#/logger'
import {isWeb} from '#/platform/detection'
import * as persisted from '#/state/persisted'
@@ -102,11 +101,7 @@ export function logEvent<E extends keyof LogEvents>(
if (Statsig.initializeCalled()) {
Statsig.logEvent(eventName, null, fullMetadata)
}
// Intentionally bypass the logger abstraction to log rich objects.
console.groupCollapsed(eventName)
console.log(fullMetadata)
console.groupEnd()
bitdrift.info(eventName, fullMetadata)
logger.info(eventName, fullMetadata)
} catch (e) {
// A log should never interrupt the calling code, whatever happens.
logger.error('Failed to log an event', {message: e})