diff options
author | Snow Pettersen <aickck@gmail.com> | 2024-12-11 20:28:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 04:28:15 +0000 |
commit | 20ac42a5a324ad553324d15ad868a1fea1868641 (patch) | |
tree | 04edf4888d2f32d3b1da073b1aa1845292dc3990 /src/logger | |
parent | c8745a9ab0a99ac3cf484e00760e72d1e9f28dfc (diff) | |
download | voidsky-20ac42a5a324ad553324d15ad868a1fea1868641.tar.zst |
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
Diffstat (limited to 'src/logger')
-rw-r--r-- | src/logger/index.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/logger/index.ts b/src/logger/index.ts index 7bd812af0..e4adc48e2 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -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) |