From 1b3e11f713f7ae04735a5ee4cf531018de4010e5 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 10 May 2024 11:00:13 +0530 Subject: [PATCH] Log errors/warnings to the console always --- desktop/src/main/log.ts | 8 ++++---- web/packages/next/log.ts | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/desktop/src/main/log.ts b/desktop/src/main/log.ts index cf1404a90..e39d2be9c 100644 --- a/desktop/src/main/log.ts +++ b/desktop/src/main/log.ts @@ -62,7 +62,7 @@ const logError = (message: string, e?: unknown) => { const logError_ = (message: string) => { log.error(`[main] [error] ${message}`); - if (isDev) console.error(`[error] ${message}`); + console.error(`[error] ${message}`); }; const logInfo = (...params: unknown[]) => { @@ -96,8 +96,8 @@ export default { * any arbitrary object that we obtain, say, when in a try-catch handler (in * JavaScript any arbitrary value can be thrown). * - * The log is written to disk. In development builds, the log is also - * printed to the main (Node.js) process console. + * The log is written to disk and printed to the main (Node.js) process's + * console. */ error: logError, /** @@ -120,7 +120,7 @@ export default { * The function can return an arbitrary value which is serialized before * being logged. * - * This log is NOT written to disk. And it is printed to the main (Node.js) + * This log is NOT written to disk. It is printed to the main (Node.js) * process console, but only on development builds. */ debug: logDebug, diff --git a/web/packages/next/log.ts b/web/packages/next/log.ts index f9ef7e549..0129a93a1 100644 --- a/web/packages/next/log.ts +++ b/web/packages/next/log.ts @@ -45,13 +45,13 @@ const messageWithError = (message: string, e?: unknown) => { const logError = (message: string, e?: unknown) => { const m = `[error] ${messageWithError(message, e)}`; - if (isDevBuild) console.error(m); + console.error(m); logToDisk(m); }; const logWarn = (message: string, e?: unknown) => { const m = `[warn] ${messageWithError(message, e)}`; - if (isDevBuild) console.error(m); + console.error(m); logToDisk(m); }; @@ -89,8 +89,7 @@ export default { * any arbitrary object that we obtain, say, when in a try-catch handler (in * JavaScript any arbitrary value can be thrown). * - * The log is written to disk. In development builds, the log is also - * printed to the browser console. + * The log is written to disk and printed to the browser console. */ error: logError, /** @@ -118,8 +117,8 @@ export default { * The function can return an arbitrary value which is serialized before * being logged. * - * This log is NOT written to disk. And it is printed to the browser - * console, but only in development builds. + * This log is NOT written to disk. It is printed to the browser console, + * but only in development builds. */ debug: logDebug, };