From d6c3800c5a40ba479b64067b9a932771bddd3e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Fri, 2 Feb 2024 14:12:40 +0100 Subject: [PATCH] fix: Do not log geolocation plugin log in Sentry Our config only send warn and error logs to Sentry. But when an error log is sent to Sentry, previous logs, including info logs, are also sent with it (in the "breadcrumb" field from Sentry). This is an issue because we currently log geolocation data as info logs. So sometimes geolocation data can be sent to Sentry if it is logged just before an error. devlog solves the issue because it does NOT log in production mode. geolocation plugin log will still be available in dev console and through the "Send logs" button in coachco2. --- src/app/domain/geolocation/helpers/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/domain/geolocation/helpers/index.ts b/src/app/domain/geolocation/helpers/index.ts index d507dfe79..3a8c33160 100644 --- a/src/app/domain/geolocation/helpers/index.ts +++ b/src/app/domain/geolocation/helpers/index.ts @@ -2,12 +2,10 @@ import BackgroundGeolocation from 'react-native-background-geolocation' import DeviceInfo from 'react-native-device-info' import CozyClient, { Q, QueryDefinition, fetchPolicies } from 'cozy-client' -import Minilog from 'cozy-minilog' +import { devlog } from '/core/tools/env' import { t } from '/locales/i18n' -const log = Minilog('📍 Geolocation') - export const getTs = (location: { timestamp: string }): number => { return parseISOString(location.timestamp).getTime() / 1000 } @@ -22,7 +20,7 @@ export const parseISOString = (ISOString: string): Date => { const Logger = BackgroundGeolocation.logger export const Log = (message: string): void => { - log.debug(message) + devlog(`📍 Geolocation Plugin ${message}`) Logger.debug(message) }