configure the bitdrift Capture SDK (#6979)

* configure bitdrift Capture SDK

* remove console log

* use the new url

* add patch to fix devtool interaction

* update patches

* fix patch

* add BITDRIFT_API_KEY to .env.example
This commit is contained in:
Snow Pettersen
2024-12-11 20:28:15 -08:00
committed by GitHub
parent c8745a9ab0
commit 20ac42a5a3
10 changed files with 64 additions and 0 deletions
+24
View File
@@ -1,3 +1,9 @@
import {
debug as bdDebug,
error as bdError,
info as bdInfo,
warn as bdWarn,
} from '@bitdrift/react-native'
import format from 'date-fns/format'
import {nanoid} from 'nanoid/non-secure'
@@ -131,6 +137,20 @@ export const consoleTransport: Transport = (
}
}
export const bitdriftTransport: Transport = (level, message) => {
const log = (
{
[LogLevel.Debug]: bdDebug,
[LogLevel.Info]: bdInfo,
[LogLevel.Log]: bdInfo,
[LogLevel.Warn]: bdWarn,
[LogLevel.Error]: bdError,
} as const
)[level]
log(message.toString())
}
export const sentryTransport: Transport = (
level,
message,
@@ -328,6 +348,10 @@ export class Logger {
*/
export const logger = new Logger()
if (!env.IS_TEST) {
logger.addTransport(bitdriftTransport)
}
if (env.IS_DEV && !env.IS_TEST) {
logger.addTransport(consoleTransport)