Skip to content

Commit

Permalink
fix: Do not log geolocation plugin log in Sentry
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zatteo committed Feb 7, 2024
1 parent a181c36 commit d6c3800
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/domain/geolocation/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}

Expand Down

0 comments on commit d6c3800

Please sign in to comment.