From e51ad6b8541c57bb65d54e9ecd16f03b688b0aa5 Mon Sep 17 00:00:00 2001 From: Katherine Jensen Date: Fri, 8 Dec 2023 14:52:09 -0800 Subject: [PATCH 1/2] 353 Update log levels --- .../hello-someone/hello-someone.web-view.html | 2 +- extensions/src/hello-world/hello-world.ts | 2 +- .../web-views/hello-world.web-view.html | 2 +- .../web-views/hello-world.web-view.tsx | 2 +- extensions/src/quick-verse/quick-verse.ts | 2 +- .../resource-viewer.web-view.tsx | 2 +- lib/papi-dts/papi.d.ts | 2 +- src/extension-host/extension-host.ts | 10 +++---- .../services/extension.service.ts | 2 +- src/main/global-this.model.ts | 2 +- src/main/main.ts | 16 ++++++------ .../testing/test-buttons-panel.component.tsx | 26 +++++++++---------- src/shared/global-this.model.ts | 2 +- src/shared/services/network-object.service.ts | 4 +-- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/extensions/src/hello-someone/hello-someone.web-view.html b/extensions/src/hello-someone/hello-someone.web-view.html index 97e496ba35..c1e18edaff 100644 --- a/extensions/src/hello-someone/hello-someone.web-view.html +++ b/extensions/src/hello-someone/hello-someone.web-view.html @@ -36,7 +36,7 @@ const { logger } = require('@papi/frontend'); function print(input) { - logger.info(input); + logger.debug(input); } const dataProviderPromise = papi.dataProviders.get('helloSomeone.people'); diff --git a/extensions/src/hello-world/hello-world.ts b/extensions/src/hello-world/hello-world.ts index 5f27f74e63..3d43c92db6 100644 --- a/extensions/src/hello-world/hello-world.ts +++ b/extensions/src/hello-world/hello-world.ts @@ -146,7 +146,7 @@ export async function activate(context: ExecutionActivationContext): Promise logger.info(`Bill's greeting: ${billGreeting}`), + (billGreeting: string | undefined) => logger.debug(`Bill's greeting: ${billGreeting}`), ); context.registrations.add(unsubGreetings); diff --git a/extensions/src/hello-world/web-views/hello-world.web-view.html b/extensions/src/hello-world/web-views/hello-world.web-view.html index d03c805ca6..1f47932c18 100644 --- a/extensions/src/hello-world/web-views/hello-world.web-view.html +++ b/extensions/src/hello-world/web-views/hello-world.web-view.html @@ -76,7 +76,7 @@ } function print(input) { - papi.logger.info(input); + papi.logger.debug(input); } document.addEventListener('DOMContentLoaded', function () { // Keep track of the times helloWorld has been run with the event diff --git a/extensions/src/hello-world/web-views/hello-world.web-view.tsx b/extensions/src/hello-world/web-views/hello-world.web-view.tsx index 2e8e536a07..2facc14920 100644 --- a/extensions/src/hello-world/web-views/hello-world.web-view.tsx +++ b/extensions/src/hello-world/web-views/hello-world.web-view.tsx @@ -82,7 +82,7 @@ globalThis.webViewComponent = function HelloWorld({ ); useEffect(() => { - logger.log( + logger.debug( `Hello World WebView previous title: ${getWebViewDefinitionUpdatableProperties()?.title}`, ); updateWebViewDefinition({ title: `Hello World ${clicks}` }); diff --git a/extensions/src/quick-verse/quick-verse.ts b/extensions/src/quick-verse/quick-verse.ts index c61022b1d0..041df721a0 100644 --- a/extensions/src/quick-verse/quick-verse.ts +++ b/extensions/src/quick-verse/quick-verse.ts @@ -290,7 +290,7 @@ export async function activate(context: ExecutionActivationContext): Promise('projectId', ''); - logger.info(`Resource Viewer project ID: ${projectId}`); + logger.debug(`Resource Viewer project ID: ${projectId}`); const [scrRef] = useSetting('platform.verseRef', defaultScrRef); diff --git a/lib/papi-dts/papi.d.ts b/lib/papi-dts/papi.d.ts index f5400a18a4..2fa70208cf 100644 --- a/lib/papi-dts/papi.d.ts +++ b/lib/papi-dts/papi.d.ts @@ -333,7 +333,7 @@ declare module 'shared/global-this.model' { * frontend */ var resourcesPath: string; - /** How much logging should be recorded. Defaults to 'info' if not packaged, 'error' if packaged */ + /** How much logging should be recorded. Defaults to 'debug' if not packaged, 'info' if packaged */ var logLevel: LogLevel; /** * A function that each React WebView extension must provide for Paranext to display it. Only used diff --git a/src/extension-host/extension-host.ts b/src/extension-host/extension-host.ts index 0eed479001..a335a90070 100644 --- a/src/extension-host/extension-host.ts +++ b/src/extension-host/extension-host.ts @@ -78,7 +78,7 @@ networkService try { const exampleData = await (await papiFetch('https://www.example.com')).text(); const results = `testExtensionHost got data: ${exampleData.substring(0, 100)}`; - logger.info(results); + logger.debug(results); return results; } catch (e) { logger.error(`testExtensionHost.getVerse() threw ${e}`); @@ -102,12 +102,12 @@ setTimeout(async () => { }>('testMain'); if (testMain) { testMain?.onDidDispose(async () => { - logger.info('testMain disposed in extension-host'); + logger.debug('testMain disposed in extension-host'); testMain = undefined; }); } else logger.error('Could not get testMain from extension host'); - logger.info(`do stuff: ${await testMain?.doStuff('extension host things')}`); + logger.debug(`do stuff: ${await testMain?.doStuff('extension host things')}`); }, 5000); // This is just testing dispose on data providers @@ -120,14 +120,14 @@ setTimeout(async () => { throw new Error('I am a bad data provider'); }, dispose: async () => { - logger.info('Inside testDP dispose'); + logger.debug('Inside testDP dispose'); return Promise.resolve(true); }, }; const realDP = await dataProviderService.registerEngine('testDP', testDP); realDP.onDidDispose(() => { - logger.info('testDP onDidDispose ran'); + logger.debug('testDP onDidDispose ran'); }); setTimeout(realDP.dispose, 3000); })(); diff --git a/src/extension-host/services/extension.service.ts b/src/extension-host/services/extension.service.ts index 94f5bb4dcf..e8bf81fb72 100644 --- a/src/extension-host/services/extension.service.ts +++ b/src/extension-host/services/extension.service.ts @@ -495,7 +495,7 @@ async function cacheExtensionTypeDeclarations(extensionInfos: ExtensionInfo[]) { ); // We found a dts file! Copy it to the appropriate destination - logger.info( + logger.debug( `Copying Extension ${extensionInfo.name}'s type declaration file ${getPathFromUri( extensionDtsInfo.uri, )} to ${getPathFromUri(extensionDtsUriDestination)}`, diff --git a/src/main/global-this.model.ts b/src/main/global-this.model.ts index 3f4b7dca8c..bf0a7a2850 100644 --- a/src/main/global-this.model.ts +++ b/src/main/global-this.model.ts @@ -22,7 +22,7 @@ globalThis.resourcesPath = app.isPackaged ? process.resourcesPath : path.join(__ globalThis.logLevel = // Assert the extracted type. // eslint-disable-next-line no-type-assertion/no-type-assertion - (getCommandLineArgument(ARG_LOG_LEVEL) as LogLevel) ?? (globalThis.isPackaged ? 'error' : 'info'); + (getCommandLineArgument(ARG_LOG_LEVEL) as LogLevel) ?? (globalThis.isPackaged ? 'info' : 'debug'); // #endregion diff --git a/src/main/main.ts b/src/main/main.ts index 71db24ba2f..1d04079adf 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -41,7 +41,7 @@ const commandHandlers: { [commandName: string]: (...args: any[]) => any } = { 'test.echoRenderer': async (message: string) => { /* const start = performance.now(); */ /* const result = */ await commandService.sendCommand('test.addThree', 1, 4, 9); - /* logger.info( + /* logger.debug( `test.addThree(...) = ${result} took ${performance.now() - start} ms`, ); */ return message; @@ -85,7 +85,7 @@ async function main() { // Extension host test setTimeout(async () => { - logger.info( + logger.debug( `Add Many (from EH): ${await commandService.sendCommand('test.addMany', 2, 5, 9, 7)}`, ); }, 20000); @@ -287,11 +287,11 @@ async function main() { const testMain = { doStuff: (stuff: string) => { const result = `testMain did stuff: ${stuff}!`; - logger.info(result); + logger.debug(result); return result; }, dispose: () => { - logger.info('testMain.dispose() ran in testMain'); + logger.debug('testMain.dispose() ran in testMain'); return Promise.resolve(true); }, }; @@ -299,10 +299,10 @@ async function main() { const testMainDisposer = await networkObjectService.set('testMain', testMain); testMain.doStuff('main things'); testMainDisposer.onDidDispose(() => { - logger.info('testMain disposed in main message #1'); + logger.debug('testMain disposed in main message #1'); }); testMainDisposer.onDidDispose(() => { - logger.info('testMain disposed in main message #2'); + logger.debug('testMain disposed in main message #2'); }); setTimeout(testMainDisposer.dispose, 20000); @@ -312,9 +312,9 @@ async function main() { getVerse: () => Promise; }>('testExtensionHost'); if (testExtensionHost) { - logger.info(`get verse: ${await testExtensionHost.getVerse()}`); + logger.debug(`get verse: ${await testExtensionHost.getVerse()}`); testExtensionHost.onDidDispose(() => { - logger.info('testExtensionHost disposed in main'); + logger.debug('testExtensionHost disposed in main'); testExtensionHost = undefined; }); } else logger.error('Could not get testExtensionHost from main'); diff --git a/src/renderer/testing/test-buttons-panel.component.tsx b/src/renderer/testing/test-buttons-panel.component.tsx index b56a8f1f9e..8b00a76649 100644 --- a/src/renderer/testing/test-buttons-panel.component.tsx +++ b/src/renderer/testing/test-buttons-panel.component.tsx @@ -73,12 +73,12 @@ const executeMany = async (fn: () => Promise) => { const avgResponseTime = requestTime.reduce((sum, time) => sum + time, 0) / numRequests; const maxTime = requestTime.reduce((max, time) => Math.max(max, time), 0); const minTime = requestTime.reduce((min, time) => Math.min(min, time), Number.MAX_VALUE); - logger.info( + logger.debug( `Of ${numRequests} requests:\n\tAvg response time: ${avgResponseTime} ms\n\tMax response time: ${maxTime} ms\n\tMin response time: ${minTime}\n\tTotal time: ${ finish - start }`, ); - logger.info(responses[responses.length - 1]); + logger.debug(responses[responses.length - 1]); } catch (e) { logger.error(e); } @@ -97,7 +97,7 @@ export default function TestButtonsPanel() { async (asyncFn: () => Promise) => { try { const result = await asyncFn(); - logger.info(result); + logger.debug(result); updatePromiseReturn(result); return result; } catch (e) { @@ -114,7 +114,7 @@ export default function TestButtonsPanel() { useCallback( ({ clientId, didReconnect }) => { const result = `Client with id ${clientId} ${didReconnect ? 're' : ''}connected!`; - logger.info(result); + logger.debug(result); updatePromiseReturn(result); }, [updatePromiseReturn], @@ -148,7 +148,7 @@ export default function TestButtonsPanel() { (async () => { try { const result = await peopleDataProvider.testRandomMethod('from test buttons panel'); - logger.info(result); + logger.debug(result); } catch (e) { logger.error(e); } @@ -195,7 +195,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echo('Echo Stuff')); - logger.info(`command:test.echo '${result}' took ${performance.now() - start} ms`); + logger.debug(`command:test.echo '${result}' took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -209,7 +209,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echoRenderer('Echo Renderer Stuff')); - logger.info( + logger.debug( `command:test.echoRenderer '${result}' took ${performance.now() - start} ms`, ); }} @@ -225,7 +225,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echoExtensionHost('Echo Extension Host Stuff')); - logger.info( + logger.debug( `command:test.echoExtensionHost '${result}' took ${performance.now() - start} ms`, ); }} @@ -243,7 +243,7 @@ export default function TestButtonsPanel() { const result = await runPromise(() => echoSomeoneRenderer('Echo Someone Renderer Stuff'), ); - logger.info( + logger.debug( `command:helloSomeone.echoSomeoneRenderer '${result}' took ${ performance.now() - start } ms`, @@ -261,7 +261,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => addThree(1, 2, 3)); - logger.info(`command:test.addThree ${result} took ${performance.now() - start} ms`); + logger.debug(`command:test.addThree ${result} took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -275,7 +275,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => addMany(1, 2, 3, 4, 5, 6)); - logger.info(`command:test.addMany ${result} took ${performance.now() - start} ms`); + logger.debug(`command:test.addMany ${result} took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -305,7 +305,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => helloWorld()); - logger.info( + logger.debug( `command:helloWorld.helloWorld ${result} took ${performance.now() - start} ms`, ); }} @@ -321,7 +321,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => helloSomeone('Paranext user')); - logger.info( + logger.debug( `command:helloSomeone.helloSomeone ${result} took ${performance.now() - start} ms`, ); }} diff --git a/src/shared/global-this.model.ts b/src/shared/global-this.model.ts index 3e8b178e76..0dd78b8a84 100644 --- a/src/shared/global-this.model.ts +++ b/src/shared/global-this.model.ts @@ -25,7 +25,7 @@ declare global { * frontend */ var resourcesPath: string; - /** How much logging should be recorded. Defaults to 'info' if not packaged, 'error' if packaged */ + /** How much logging should be recorded. Defaults to 'debug' if not packaged, 'info' if packaged */ var logLevel: LogLevel; /** * A function that each React WebView extension must provide for Paranext to display it. Only used diff --git a/src/shared/services/network-object.service.ts b/src/shared/services/network-object.service.ts index 093c07a7b6..603997be78 100644 --- a/src/shared/services/network-object.service.ts +++ b/src/shared/services/network-object.service.ts @@ -1,4 +1,4 @@ -// #region imports +// #region imports import * as networkService from '@shared/services/network.service'; import { @@ -523,7 +523,7 @@ const set = async ( // Notify that the network object was successfully registered // eslint-disable-next-line no-type-assertion/no-type-assertion const netObjDetails = createNetworkObjectDetails(id, objectToShare as Record); - logger.info(`Network object registered: ${serialize(netObjDetails)}`); + logger.debug(`Network object registered: ${serialize(netObjDetails)}`); onDidCreateNetworkObjectEmitter.emit(netObjDetails); // Override objectToShare's type's force-undefined onDidDispose to DisposableNetworkObject's From f37d185d15c3da8d1c3678f650d90ccda2fa6204 Mon Sep 17 00:00:00 2001 From: Katherine Jensen Date: Fri, 8 Dec 2023 14:52:09 -0800 Subject: [PATCH 2/2] 353 Update log levels --- .../hello-someone/hello-someone.web-view.html | 2 +- extensions/src/hello-world/hello-world.ts | 2 +- .../web-views/hello-world.web-view.html | 2 +- .../web-views/hello-world.web-view.tsx | 2 +- extensions/src/quick-verse/quick-verse.ts | 2 +- .../resource-viewer.web-view.tsx | 2 +- lib/papi-dts/papi.d.ts | 2 +- src/extension-host/extension-host.ts | 10 +++---- .../services/extension.service.ts | 2 +- src/main/global-this.model.ts | 2 +- src/main/main.ts | 16 ++++++------ .../testing/test-buttons-panel.component.tsx | 26 +++++++++---------- src/shared/global-this.model.ts | 2 +- src/shared/services/network-object.service.ts | 4 +-- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/extensions/src/hello-someone/hello-someone.web-view.html b/extensions/src/hello-someone/hello-someone.web-view.html index 97e496ba35..c1e18edaff 100644 --- a/extensions/src/hello-someone/hello-someone.web-view.html +++ b/extensions/src/hello-someone/hello-someone.web-view.html @@ -36,7 +36,7 @@ const { logger } = require('@papi/frontend'); function print(input) { - logger.info(input); + logger.debug(input); } const dataProviderPromise = papi.dataProviders.get('helloSomeone.people'); diff --git a/extensions/src/hello-world/hello-world.ts b/extensions/src/hello-world/hello-world.ts index 5f27f74e63..3d43c92db6 100644 --- a/extensions/src/hello-world/hello-world.ts +++ b/extensions/src/hello-world/hello-world.ts @@ -146,7 +146,7 @@ export async function activate(context: ExecutionActivationContext): Promise logger.info(`Bill's greeting: ${billGreeting}`), + (billGreeting: string | undefined) => logger.debug(`Bill's greeting: ${billGreeting}`), ); context.registrations.add(unsubGreetings); diff --git a/extensions/src/hello-world/web-views/hello-world.web-view.html b/extensions/src/hello-world/web-views/hello-world.web-view.html index d03c805ca6..1f47932c18 100644 --- a/extensions/src/hello-world/web-views/hello-world.web-view.html +++ b/extensions/src/hello-world/web-views/hello-world.web-view.html @@ -76,7 +76,7 @@ } function print(input) { - papi.logger.info(input); + papi.logger.debug(input); } document.addEventListener('DOMContentLoaded', function () { // Keep track of the times helloWorld has been run with the event diff --git a/extensions/src/hello-world/web-views/hello-world.web-view.tsx b/extensions/src/hello-world/web-views/hello-world.web-view.tsx index 2e8e536a07..2facc14920 100644 --- a/extensions/src/hello-world/web-views/hello-world.web-view.tsx +++ b/extensions/src/hello-world/web-views/hello-world.web-view.tsx @@ -82,7 +82,7 @@ globalThis.webViewComponent = function HelloWorld({ ); useEffect(() => { - logger.log( + logger.debug( `Hello World WebView previous title: ${getWebViewDefinitionUpdatableProperties()?.title}`, ); updateWebViewDefinition({ title: `Hello World ${clicks}` }); diff --git a/extensions/src/quick-verse/quick-verse.ts b/extensions/src/quick-verse/quick-verse.ts index c61022b1d0..041df721a0 100644 --- a/extensions/src/quick-verse/quick-verse.ts +++ b/extensions/src/quick-verse/quick-verse.ts @@ -290,7 +290,7 @@ export async function activate(context: ExecutionActivationContext): Promise('projectId', ''); - logger.info(`Resource Viewer project ID: ${projectId}`); + logger.debug(`Resource Viewer project ID: ${projectId}`); const [scrRef] = useSetting('platform.verseRef', defaultScrRef); diff --git a/lib/papi-dts/papi.d.ts b/lib/papi-dts/papi.d.ts index f5400a18a4..2fa70208cf 100644 --- a/lib/papi-dts/papi.d.ts +++ b/lib/papi-dts/papi.d.ts @@ -333,7 +333,7 @@ declare module 'shared/global-this.model' { * frontend */ var resourcesPath: string; - /** How much logging should be recorded. Defaults to 'info' if not packaged, 'error' if packaged */ + /** How much logging should be recorded. Defaults to 'debug' if not packaged, 'info' if packaged */ var logLevel: LogLevel; /** * A function that each React WebView extension must provide for Paranext to display it. Only used diff --git a/src/extension-host/extension-host.ts b/src/extension-host/extension-host.ts index 0eed479001..a335a90070 100644 --- a/src/extension-host/extension-host.ts +++ b/src/extension-host/extension-host.ts @@ -78,7 +78,7 @@ networkService try { const exampleData = await (await papiFetch('https://www.example.com')).text(); const results = `testExtensionHost got data: ${exampleData.substring(0, 100)}`; - logger.info(results); + logger.debug(results); return results; } catch (e) { logger.error(`testExtensionHost.getVerse() threw ${e}`); @@ -102,12 +102,12 @@ setTimeout(async () => { }>('testMain'); if (testMain) { testMain?.onDidDispose(async () => { - logger.info('testMain disposed in extension-host'); + logger.debug('testMain disposed in extension-host'); testMain = undefined; }); } else logger.error('Could not get testMain from extension host'); - logger.info(`do stuff: ${await testMain?.doStuff('extension host things')}`); + logger.debug(`do stuff: ${await testMain?.doStuff('extension host things')}`); }, 5000); // This is just testing dispose on data providers @@ -120,14 +120,14 @@ setTimeout(async () => { throw new Error('I am a bad data provider'); }, dispose: async () => { - logger.info('Inside testDP dispose'); + logger.debug('Inside testDP dispose'); return Promise.resolve(true); }, }; const realDP = await dataProviderService.registerEngine('testDP', testDP); realDP.onDidDispose(() => { - logger.info('testDP onDidDispose ran'); + logger.debug('testDP onDidDispose ran'); }); setTimeout(realDP.dispose, 3000); })(); diff --git a/src/extension-host/services/extension.service.ts b/src/extension-host/services/extension.service.ts index 94f5bb4dcf..e8bf81fb72 100644 --- a/src/extension-host/services/extension.service.ts +++ b/src/extension-host/services/extension.service.ts @@ -495,7 +495,7 @@ async function cacheExtensionTypeDeclarations(extensionInfos: ExtensionInfo[]) { ); // We found a dts file! Copy it to the appropriate destination - logger.info( + logger.debug( `Copying Extension ${extensionInfo.name}'s type declaration file ${getPathFromUri( extensionDtsInfo.uri, )} to ${getPathFromUri(extensionDtsUriDestination)}`, diff --git a/src/main/global-this.model.ts b/src/main/global-this.model.ts index 3f4b7dca8c..bf0a7a2850 100644 --- a/src/main/global-this.model.ts +++ b/src/main/global-this.model.ts @@ -22,7 +22,7 @@ globalThis.resourcesPath = app.isPackaged ? process.resourcesPath : path.join(__ globalThis.logLevel = // Assert the extracted type. // eslint-disable-next-line no-type-assertion/no-type-assertion - (getCommandLineArgument(ARG_LOG_LEVEL) as LogLevel) ?? (globalThis.isPackaged ? 'error' : 'info'); + (getCommandLineArgument(ARG_LOG_LEVEL) as LogLevel) ?? (globalThis.isPackaged ? 'info' : 'debug'); // #endregion diff --git a/src/main/main.ts b/src/main/main.ts index 71db24ba2f..1d04079adf 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -41,7 +41,7 @@ const commandHandlers: { [commandName: string]: (...args: any[]) => any } = { 'test.echoRenderer': async (message: string) => { /* const start = performance.now(); */ /* const result = */ await commandService.sendCommand('test.addThree', 1, 4, 9); - /* logger.info( + /* logger.debug( `test.addThree(...) = ${result} took ${performance.now() - start} ms`, ); */ return message; @@ -85,7 +85,7 @@ async function main() { // Extension host test setTimeout(async () => { - logger.info( + logger.debug( `Add Many (from EH): ${await commandService.sendCommand('test.addMany', 2, 5, 9, 7)}`, ); }, 20000); @@ -287,11 +287,11 @@ async function main() { const testMain = { doStuff: (stuff: string) => { const result = `testMain did stuff: ${stuff}!`; - logger.info(result); + logger.debug(result); return result; }, dispose: () => { - logger.info('testMain.dispose() ran in testMain'); + logger.debug('testMain.dispose() ran in testMain'); return Promise.resolve(true); }, }; @@ -299,10 +299,10 @@ async function main() { const testMainDisposer = await networkObjectService.set('testMain', testMain); testMain.doStuff('main things'); testMainDisposer.onDidDispose(() => { - logger.info('testMain disposed in main message #1'); + logger.debug('testMain disposed in main message #1'); }); testMainDisposer.onDidDispose(() => { - logger.info('testMain disposed in main message #2'); + logger.debug('testMain disposed in main message #2'); }); setTimeout(testMainDisposer.dispose, 20000); @@ -312,9 +312,9 @@ async function main() { getVerse: () => Promise; }>('testExtensionHost'); if (testExtensionHost) { - logger.info(`get verse: ${await testExtensionHost.getVerse()}`); + logger.debug(`get verse: ${await testExtensionHost.getVerse()}`); testExtensionHost.onDidDispose(() => { - logger.info('testExtensionHost disposed in main'); + logger.debug('testExtensionHost disposed in main'); testExtensionHost = undefined; }); } else logger.error('Could not get testExtensionHost from main'); diff --git a/src/renderer/testing/test-buttons-panel.component.tsx b/src/renderer/testing/test-buttons-panel.component.tsx index b56a8f1f9e..8b00a76649 100644 --- a/src/renderer/testing/test-buttons-panel.component.tsx +++ b/src/renderer/testing/test-buttons-panel.component.tsx @@ -73,12 +73,12 @@ const executeMany = async (fn: () => Promise) => { const avgResponseTime = requestTime.reduce((sum, time) => sum + time, 0) / numRequests; const maxTime = requestTime.reduce((max, time) => Math.max(max, time), 0); const minTime = requestTime.reduce((min, time) => Math.min(min, time), Number.MAX_VALUE); - logger.info( + logger.debug( `Of ${numRequests} requests:\n\tAvg response time: ${avgResponseTime} ms\n\tMax response time: ${maxTime} ms\n\tMin response time: ${minTime}\n\tTotal time: ${ finish - start }`, ); - logger.info(responses[responses.length - 1]); + logger.debug(responses[responses.length - 1]); } catch (e) { logger.error(e); } @@ -97,7 +97,7 @@ export default function TestButtonsPanel() { async (asyncFn: () => Promise) => { try { const result = await asyncFn(); - logger.info(result); + logger.debug(result); updatePromiseReturn(result); return result; } catch (e) { @@ -114,7 +114,7 @@ export default function TestButtonsPanel() { useCallback( ({ clientId, didReconnect }) => { const result = `Client with id ${clientId} ${didReconnect ? 're' : ''}connected!`; - logger.info(result); + logger.debug(result); updatePromiseReturn(result); }, [updatePromiseReturn], @@ -148,7 +148,7 @@ export default function TestButtonsPanel() { (async () => { try { const result = await peopleDataProvider.testRandomMethod('from test buttons panel'); - logger.info(result); + logger.debug(result); } catch (e) { logger.error(e); } @@ -195,7 +195,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echo('Echo Stuff')); - logger.info(`command:test.echo '${result}' took ${performance.now() - start} ms`); + logger.debug(`command:test.echo '${result}' took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -209,7 +209,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echoRenderer('Echo Renderer Stuff')); - logger.info( + logger.debug( `command:test.echoRenderer '${result}' took ${performance.now() - start} ms`, ); }} @@ -225,7 +225,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => echoExtensionHost('Echo Extension Host Stuff')); - logger.info( + logger.debug( `command:test.echoExtensionHost '${result}' took ${performance.now() - start} ms`, ); }} @@ -243,7 +243,7 @@ export default function TestButtonsPanel() { const result = await runPromise(() => echoSomeoneRenderer('Echo Someone Renderer Stuff'), ); - logger.info( + logger.debug( `command:helloSomeone.echoSomeoneRenderer '${result}' took ${ performance.now() - start } ms`, @@ -261,7 +261,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => addThree(1, 2, 3)); - logger.info(`command:test.addThree ${result} took ${performance.now() - start} ms`); + logger.debug(`command:test.addThree ${result} took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -275,7 +275,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => addMany(1, 2, 3, 4, 5, 6)); - logger.info(`command:test.addMany ${result} took ${performance.now() - start} ms`); + logger.debug(`command:test.addMany ${result} took ${performance.now() - start} ms`); }} onContextMenu={(e) => { e.preventDefault(); @@ -305,7 +305,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => helloWorld()); - logger.info( + logger.debug( `command:helloWorld.helloWorld ${result} took ${performance.now() - start} ms`, ); }} @@ -321,7 +321,7 @@ export default function TestButtonsPanel() { onClick={async () => { const start = performance.now(); const result = await runPromise(() => helloSomeone('Paranext user')); - logger.info( + logger.debug( `command:helloSomeone.helloSomeone ${result} took ${performance.now() - start} ms`, ); }} diff --git a/src/shared/global-this.model.ts b/src/shared/global-this.model.ts index 3e8b178e76..0dd78b8a84 100644 --- a/src/shared/global-this.model.ts +++ b/src/shared/global-this.model.ts @@ -25,7 +25,7 @@ declare global { * frontend */ var resourcesPath: string; - /** How much logging should be recorded. Defaults to 'info' if not packaged, 'error' if packaged */ + /** How much logging should be recorded. Defaults to 'debug' if not packaged, 'info' if packaged */ var logLevel: LogLevel; /** * A function that each React WebView extension must provide for Paranext to display it. Only used diff --git a/src/shared/services/network-object.service.ts b/src/shared/services/network-object.service.ts index 093c07a7b6..603997be78 100644 --- a/src/shared/services/network-object.service.ts +++ b/src/shared/services/network-object.service.ts @@ -1,4 +1,4 @@ -// #region imports +// #region imports import * as networkService from '@shared/services/network.service'; import { @@ -523,7 +523,7 @@ const set = async ( // Notify that the network object was successfully registered // eslint-disable-next-line no-type-assertion/no-type-assertion const netObjDetails = createNetworkObjectDetails(id, objectToShare as Record); - logger.info(`Network object registered: ${serialize(netObjDetails)}`); + logger.debug(`Network object registered: ${serialize(netObjDetails)}`); onDidCreateNetworkObjectEmitter.emit(netObjDetails); // Override objectToShare's type's force-undefined onDidDispose to DisposableNetworkObject's