From 9cbd3c0937d22e8dccbd9c086d3a3a24dbd27b3a Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 16 Jan 2024 17:48:35 -0600 Subject: [PATCH] Reduce some Sentry logs (#2549) * Reduce some Sentry logs * Update tests --- src/state/persisted/__tests__/migrate.test.ts | 6 +++--- src/state/persisted/legacy.ts | 4 ++-- src/state/queries/feed.ts | 3 ++- src/state/queries/notifications/unread.tsx | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/state/persisted/__tests__/migrate.test.ts b/src/state/persisted/__tests__/migrate.test.ts index d42580ef..2435ed24 100644 --- a/src/state/persisted/__tests__/migrate.test.ts +++ b/src/state/persisted/__tests__/migrate.test.ts @@ -26,7 +26,7 @@ test('migrate: fresh install', async () => { expect(AsyncStorage.getItem).toHaveBeenCalledWith('root') expect(read).toHaveBeenCalledTimes(1) - expect(logger.log).toHaveBeenCalledWith( + expect(logger.info).toHaveBeenCalledWith( 'persisted state: no migration needed', ) }) @@ -38,7 +38,7 @@ test('migrate: fresh install, existing new storage', async () => { expect(AsyncStorage.getItem).toHaveBeenCalledWith('root') expect(read).toHaveBeenCalledTimes(1) - expect(logger.log).toHaveBeenCalledWith( + expect(logger.info).toHaveBeenCalledWith( 'persisted state: no migration needed', ) }) @@ -68,7 +68,7 @@ test('migrate: has legacy data', async () => { await migrate() expect(write).toHaveBeenCalledWith(transform(fixtures.LEGACY_DATA_DUMP)) - expect(logger.log).toHaveBeenCalledWith( + expect(logger.info).toHaveBeenCalledWith( 'persisted state: migrated legacy storage', ) }) diff --git a/src/state/persisted/legacy.ts b/src/state/persisted/legacy.ts index 334ef1d9..097d6bc5 100644 --- a/src/state/persisted/legacy.ts +++ b/src/state/persisted/legacy.ts @@ -164,14 +164,14 @@ export async function migrate() { if (validate.success) { await write(newData) - logger.log('persisted state: migrated legacy storage') + logger.info('persisted state: migrated legacy storage') } else { logger.error('persisted state: legacy data failed validation', { error: validate.error, }) } } else { - logger.log('persisted state: no migration needed') + logger.info('persisted state: no migration needed') } } catch (e: any) { logger.error(e, { diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index 7a55b4e1..4acc7179 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -272,7 +272,8 @@ export function usePinnedFeedsInfos(): { }, }) } catch (e) { - logger.warn(`usePinnedFeedsInfos: failed to fetch ${uri}`, { + // expected failure + logger.info(`usePinnedFeedsInfos: failed to fetch ${uri}`, { error: e, }) } diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index 49bb5a29..a96b5622 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -167,7 +167,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } broadcast.postMessage({event: unreadCountStr}) } catch (e) { - logger.error('Failed to check unread notifications', {error: e}) + logger.warn('Failed to check unread notifications', {error: e}) } },