mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Chore: Mobile tests: Hide debug logging (#10977)
This commit is contained in:
parent
2f7b2fb948
commit
2a2dd96c02
@ -1,5 +1,6 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import shared from '@joplin/lib/components/shared/note-screen-shared';
|
import shared from '@joplin/lib/components/shared/note-screen-shared';
|
||||||
|
import Logger from '@joplin/utils/Logger';
|
||||||
|
|
||||||
export type HandleMessageCallback = (message: string)=> void;
|
export type HandleMessageCallback = (message: string)=> void;
|
||||||
export type OnMarkForDownloadCallback = (resource: { resourceId: string })=> void;
|
export type OnMarkForDownloadCallback = (resource: { resourceId: string })=> void;
|
||||||
@ -12,6 +13,8 @@ interface MessageCallbacks {
|
|||||||
onCheckboxChange: HandleMessageCallback;
|
onCheckboxChange: HandleMessageCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const logger = Logger.create('useOnMessage');
|
||||||
|
|
||||||
export default function useOnMessage(
|
export default function useOnMessage(
|
||||||
noteBody: string,
|
noteBody: string,
|
||||||
callbacks: MessageCallbacks,
|
callbacks: MessageCallbacks,
|
||||||
@ -29,10 +32,10 @@ export default function useOnMessage(
|
|||||||
return useCallback((msg: string) => {
|
return useCallback((msg: string) => {
|
||||||
const isScrollMessage = msg.startsWith('onscroll:');
|
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) {
|
if (!isScrollMessage) {
|
||||||
// eslint-disable-next-line no-console
|
logger.debug('Got IPC message: ', msg);
|
||||||
console.info('Got IPC message: ', msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.indexOf('checkboxclick:') === 0) {
|
if (msg.indexOf('checkboxclick:') === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user