From 2a2dd96c02f54ecb3154cff59e590ef4d138bb92 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Wed, 4 Sep 2024 04:13:48 -0700 Subject: [PATCH] Chore: Mobile tests: Hide debug logging (#10977) --- .../components/NoteBodyViewer/hooks/useOnMessage.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts index 89e0a7669..b5d0bd56e 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts @@ -1,5 +1,6 @@ import { useCallback } from 'react'; import shared from '@joplin/lib/components/shared/note-screen-shared'; +import Logger from '@joplin/utils/Logger'; export type HandleMessageCallback = (message: string)=> void; export type OnMarkForDownloadCallback = (resource: { resourceId: string })=> void; @@ -12,6 +13,8 @@ interface MessageCallbacks { onCheckboxChange: HandleMessageCallback; } +const logger = Logger.create('useOnMessage'); + export default function useOnMessage( noteBody: string, callbacks: MessageCallbacks, @@ -29,10 +32,10 @@ export default function useOnMessage( return useCallback((msg: string) => { const isScrollMessage = msg.startsWith('onscroll:'); - // Scroll messages are very frequent so we avoid logging them. + // Scroll messages are very frequent so we avoid logging them, even + // in debug mode if (!isScrollMessage) { - // eslint-disable-next-line no-console - console.info('Got IPC message: ', msg); + logger.debug('Got IPC message: ', msg); } if (msg.indexOf('checkboxclick:') === 0) {