From 0d72e49998af5328d0f41f4fbc8e982c8904ab06 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 10 Dec 2020 11:16:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Capture=20log=20for=200=20gas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/error.ts | 11 ++++++++++- app/utils/sentry.ts | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/utils/error.ts b/app/utils/error.ts index 6a2a63ef1..f5f3df6ed 100644 --- a/app/utils/error.ts +++ b/app/utils/error.ts @@ -1,4 +1,4 @@ -import { sentryCaptureError } from './sentry' +import { sentryCaptureError, sentryCaptureMessage } from './sentry' export function logError(err: any) { if (__DEV__) { @@ -8,3 +8,12 @@ export function logError(err: any) { sentryCaptureError(err) } } + +export function logMessage(msg: string) { + if (__DEV__) { + console.tron.warn(msg) + } else { + console.warn(msg) + sentryCaptureMessage(msg) + } +} diff --git a/app/utils/sentry.ts b/app/utils/sentry.ts index 937feb542..bbba3793d 100644 --- a/app/utils/sentry.ts +++ b/app/utils/sentry.ts @@ -9,6 +9,10 @@ export function initSentry(dsn: string, environment: string) { }) } +export function sentryCaptureMessage(msg: string) { + return Sentry.captureMessage(msg) +} + export function sentryCaptureError(err: unknown) { return Sentry.captureException(err) }