diff --git a/src/mono/browser/runtime/assets.ts b/src/mono/browser/runtime/assets.ts index f8725a36e12502..e6edf705ad6970 100644 --- a/src/mono/browser/runtime/assets.ts +++ b/src/mono/browser/runtime/assets.ts @@ -15,7 +15,7 @@ import { setSegmentationRulesFromJson } from "./hybrid-globalization/grapheme-se // this need to be run only after onRuntimeInitialized event, when the memory is ready export function instantiate_asset (asset: AssetEntry, url: string, bytes: Uint8Array): void { - mono_log_debug(`Loaded:${asset.name} as ${asset.behavior} size ${bytes.length} from ${url}`); + mono_log_debug(() => `Loaded:${asset.name} as ${asset.behavior} size ${bytes.length} from ${url}`); const mark = startMeasure(); const virtualName: string = typeof (asset.virtualPath) === "string" @@ -64,7 +64,7 @@ export function instantiate_asset (asset: AssetEntry, url: string, bytes: Uint8A parentDirectory = "/"; } - mono_log_debug(`Creating file '${fileName}' in directory '${parentDirectory}'`); + mono_log_debug(() => `Creating file '${fileName}' in directory '${parentDirectory}'`); Module.FS_createDataFile( parentDirectory, fileName, diff --git a/src/mono/browser/runtime/diagnostics/mock/index.ts b/src/mono/browser/runtime/diagnostics/mock/index.ts index d320980e454da4..3d1014d02c126f 100644 --- a/src/mono/browser/runtime/diagnostics/mock/index.ts +++ b/src/mono/browser/runtime/diagnostics/mock/index.ts @@ -31,7 +31,7 @@ export function mock (script: MockScript): Mock { class MockScriptEngineSocketImpl implements MockRemoteSocket { constructor (private readonly engine: MockScriptEngineImpl) { } send (data: string | ArrayBuffer): void { - mono_log_debug(`mock ${this.engine.ident} client sent: `, data); + mono_log_debug(() => `mock ${this.engine.ident} client sent: ${data}`); let event: MessageEvent | null = null; if (typeof data === "string") { event = new MessageEvent("message", { data }); @@ -46,15 +46,15 @@ export function mock (script: MockScript): Mock { } addEventListener(event: T, listener: (event: WebSocketEventMap[T]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener (event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void { - mono_log_debug(`mock ${this.engine.ident} client added listener for ${event}`); + mono_log_debug(() => `mock ${this.engine.ident} client added listener for ${event}`); this.engine.eventTarget.addEventListener(event, listener, options); } removeEventListener (event: string, listener: EventListenerOrEventListenerObject): void { - mono_log_debug(`mock ${this.engine.ident} client removed listener for ${event}`); + mono_log_debug(() => `mock ${this.engine.ident} client removed listener for ${event}`); this.engine.eventTarget.removeEventListener(event, listener); } close (): void { - mono_log_debug(`mock ${this.engine.ident} client closed`); + mono_log_debug(() => `mock ${this.engine.ident} client closed`); this.engine.mockReplyEventTarget.dispatchEvent(new CloseEvent("close")); } dispatchEvent (ev: Event): boolean { @@ -73,7 +73,7 @@ export function mock (script: MockScript): Mock { } reply (data: ArrayBuffer | Uint8Array) { - mono_log_debug(`mock ${this.ident} reply:`, data); + mono_log_debug(() => `mock ${this.ident} reply:${data}`); let sendData: ArrayBuffer; if (typeof data === "object" && data instanceof ArrayBuffer) { sendData = new ArrayBuffer(data.byteLength); @@ -92,7 +92,7 @@ export function mock (script: MockScript): Mock { } processSend (onMessage: (data: ArrayBuffer) => any): Promise { - mono_log_debug(`mock ${this.ident} processSend`); + mono_log_debug(() => `mock ${this.ident} processSend`); return new Promise((resolve, reject) => { this.mockReplyEventTarget.addEventListener("close", () => { @@ -105,7 +105,7 @@ export function mock (script: MockScript): Mock { reject(new Error("mock script connection received string data")); } - mono_log_debug(`mock ${this.ident} processSend got:`, data.byteLength); + mono_log_debug(() => `mock ${this.ident} processSend got: ${data.byteLength}`); onMessage(data); }); @@ -113,7 +113,7 @@ export function mock (script: MockScript): Mock { } async waitForSend (filter: (data: ArrayBuffer) => boolean, extract?: (data: ArrayBuffer) => T): Promise { - mono_log_debug(`mock ${this.ident} waitForSend`); + mono_log_debug(() => `mock ${this.ident} waitForSend`); const data = await new Promise((resolve) => { this.mockReplyEventTarget.addEventListener("message", (event: any) => { @@ -122,7 +122,7 @@ export function mock (script: MockScript): Mock { mono_log_warn(`mock ${this.ident} waitForSend got string:`, data); throw new Error("mock script connection received string data"); } - mono_log_debug(`mock ${this.ident} waitForSend got:`, data.byteLength); + mono_log_debug(() => `mock ${this.ident} waitForSend got:${data.byteLength}`); resolve(data); }, { once: true }); @@ -153,7 +153,7 @@ export function mock (script: MockScript): Mock { } open (): MockRemoteSocket { const i = this.openCount++; - mono_log_debug(`mock ${i} open`); + mono_log_debug(() => `mock ${i} open`); return this.engines[i].socket; } diff --git a/src/mono/browser/runtime/diagnostics/server_pthread/index.ts b/src/mono/browser/runtime/diagnostics/server_pthread/index.ts index cbc94347a7d20e..1175aeb2d8c52a 100644 --- a/src/mono/browser/runtime/diagnostics/server_pthread/index.ts +++ b/src/mono/browser/runtime/diagnostics/server_pthread/index.ts @@ -139,12 +139,12 @@ class DiagnosticServerImpl implements DiagnosticServer { async advertiseAndWaitForClient (): Promise { try { const connNum = this.openCount++; - mono_log_debug("opening websocket and sending ADVR_V1", connNum); + mono_log_debug(() => `opening websocket and sending ADVR_V1 ${connNum}`); const ws = await this.openSocket(); const p = addOneShotProtocolCommandEventListener(createProtocolSocket(ws)); this.sendAdvertise(ws); const message = await p; - mono_log_debug("received advertising response: ", message, connNum); + mono_log_debug(() => `received advertising response: ${message},${connNum}`); queueMicrotask(() => this.parseAndDispatchMessage(ws, connNum, message)); } finally { // if there were errors, resume the runtime anyway @@ -183,9 +183,9 @@ class DiagnosticServerImpl implements DiagnosticServer { } parseCommand (message: ProtocolCommandEvent, connNum: number): ProtocolClientCommandBase | null { - mono_log_debug("parsing byte command: ", message.data, connNum); + mono_log_debug(() => `parsing byte command: ${message.data}, ${connNum}`); const result = parseProtocolCommand(message.data); - mono_log_debug("parsed byte command: ", result, connNum); + mono_log_debug(() => `parsed byte command: ${result} ${connNum}`); if (result.success) { return result.result; } else { @@ -236,7 +236,7 @@ class DiagnosticServerImpl implements DiagnosticServer { } async stopEventPipe (ws: WebSocket | MockRemoteSocket, sessionID: EventPipeSessionIDImpl): Promise { - mono_log_debug("stopEventPipe", sessionID); + mono_log_debug(() => `stopEventPipe ${sessionID}`); cwraps.mono_wasm_event_pipe_session_disable(sessionID); // we might send OK before the session is actually stopped since the websocket is async // but the client end should be robust to that. @@ -252,7 +252,7 @@ class DiagnosticServerImpl implements DiagnosticServer { sessionIDbuf[3] = (session.sessionID >> 24) & 0xFF; // sessionIDbuf[4..7] is 0 because all our session IDs are 32-bit this.postClientReplyOK(ws, sessionIDbuf); - mono_log_debug("created session, now streaming: ", session); + mono_log_debug(() => `created session, now streaming: ${session}`); cwraps.mono_wasm_event_pipe_session_start_streaming(session.sessionID); } @@ -291,7 +291,7 @@ function parseProtocolCommand (data: ArrayBuffer | BinaryProtocolCommand): Parse export function mono_wasm_diagnostic_server_on_server_thread_created (websocketUrlPtr: CharPtr): void { mono_assert(WasmEnableThreads, "The diagnostic server requires threads to be enabled during build time."); const websocketUrl = utf8ToString(websocketUrlPtr); - mono_log_debug(`mono_wasm_diagnostic_server_on_server_thread_created, url ${websocketUrl}`); + mono_log_debug(() => `mono_wasm_diagnostic_server_on_server_thread_created, url ${websocketUrl}`); let mock: PromiseAndController | undefined = undefined; if (monoDiagnosticsMock && websocketUrl.startsWith("mock:")) { mock = createPromiseController(); diff --git a/src/mono/browser/runtime/diagnostics/server_pthread/protocol-socket.ts b/src/mono/browser/runtime/diagnostics/server_pthread/protocol-socket.ts index 049d1525cd32bd..9b6cea2bc060d6 100644 --- a/src/mono/browser/runtime/diagnostics/server_pthread/protocol-socket.ts +++ b/src/mono/browser/runtime/diagnostics/server_pthread/protocol-socket.ts @@ -74,7 +74,7 @@ class StatefulParser { result = this.tryAppendBuffer(new Uint8Array(buf)); } if (result.success) { - mono_log_debug("protocol-socket: got result", result); + mono_log_debug(() => `protocol-socket: got result ${result}`); this.setState(result.newState); if (result.command) { const command = result.command; @@ -177,14 +177,14 @@ class ProtocolSocketImpl implements ProtocolSocket { onMessage (this: ProtocolSocketImpl, ev: MessageEvent): void { const data = ev.data; - mono_log_debug("protocol socket received message", ev.data); + mono_log_debug(() => `protocol socket received message ${ev.data}`); if (typeof data === "object" && data instanceof ArrayBuffer) { this.onArrayBuffer(data); } else if (typeof data === "object" && data instanceof Blob) { data.arrayBuffer().then(this.onArrayBuffer.bind(this)); } else if (typeof data === "string") { // otherwise it's string, ignore it. - mono_log_debug("protocol socket received string message; ignoring it", ev.data); + mono_log_debug(() => `protocol socket received string message; ignoring it ${ev.data}`); } else { assertNever(data); } @@ -195,15 +195,15 @@ class ProtocolSocketImpl implements ProtocolSocket { } onArrayBuffer (this: ProtocolSocketImpl, buf: ArrayBuffer) { - mono_log_debug("protocol-socket: parsing array buffer", buf); + mono_log_debug(() => `protocol-socket: parsing array buffer ${buf}`); this.statefulParser.receiveBuffer(buf); } // called by the stateful parser when it has a complete command emitCommandCallback (this: this, command: BinaryProtocolCommand): void { - mono_log_debug("protocol-socket: queueing command", command); + mono_log_debug(() => `protocol-socket: queueing command ${command}`); queueMicrotask(() => { - mono_log_debug("dispatching protocol event with command", command); + mono_log_debug(() => `dispatching protocol event with command ${command}`); this.dispatchProtocolCommandEvent(command); }); } diff --git a/src/mono/browser/runtime/diagnostics/server_pthread/socket-connection.ts b/src/mono/browser/runtime/diagnostics/server_pthread/socket-connection.ts index fec4a1fc32aabd..bdecd140999c86 100644 --- a/src/mono/browser/runtime/diagnostics/server_pthread/socket-connection.ts +++ b/src/mono/browser/runtime/diagnostics/server_pthread/socket-connection.ts @@ -100,7 +100,7 @@ export class EventPipeSocketConnection { } private _onError (event: Event) { - mono_log_debug("EventPipe session stream websocket error", event); + mono_log_debug(() => `EventPipe session stream websocket error ${event}`); this._state = ListenerState.Error; this.stream.close(); // TODO: notify runtime that connection had an error diff --git a/src/mono/browser/runtime/invoke-cs.ts b/src/mono/browser/runtime/invoke-cs.ts index f613df56687d4b..3b7a869e8661c3 100644 --- a/src/mono/browser/runtime/invoke-cs.ts +++ b/src/mono/browser/runtime/invoke-cs.ts @@ -20,7 +20,7 @@ import { mono_log_debug } from "./logging"; export function mono_wasm_bind_cs_function (method: MonoMethod, assemblyName: string, namespaceName: string, shortClassName: string, methodName: string, signatureHash: number, signature: JSFunctionSignature): void { const fullyQualifiedName = `[${assemblyName}] ${namespaceName}.${shortClassName}:${methodName}`; const mark = startMeasure(); - mono_log_debug(`Binding [JSExport] ${namespaceName}.${shortClassName}:${methodName} from ${assemblyName} assembly`); + mono_log_debug(() => `Binding [JSExport] ${namespaceName}.${shortClassName}:${methodName} from ${assemblyName} assembly`); const version = get_signature_version(signature); mono_assert(version === 2, () => `Signature version ${version} mismatch.`); diff --git a/src/mono/browser/runtime/invoke-js.ts b/src/mono/browser/runtime/invoke-js.ts index c5d385a17e4e44..191bd8a0fc2934 100644 --- a/src/mono/browser/runtime/invoke-js.ts +++ b/src/mono/browser/runtime/invoke-js.ts @@ -89,7 +89,7 @@ function bind_js_import (signature: JSFunctionSignature): Function { const js_module_name = get_signature_module_name(signature)!; const function_handle = get_signature_handle(signature); - mono_log_debug(`Binding [JSImport] ${js_function_name} from ${js_module_name} module`); + mono_log_debug(() => `Binding [JSImport] ${js_function_name} from ${js_module_name} module`); const fn = mono_wasm_lookup_js_import(js_function_name, js_module_name); const args_count = get_signature_argument_count(signature); @@ -369,7 +369,7 @@ export function mono_wasm_invoke_js_function_impl (bound_function_js_handle: JSH export function mono_wasm_set_module_imports (module_name: string, moduleImports: any) { importedModules.set(module_name, moduleImports); - mono_log_debug(`added module imports '${module_name}'`); + mono_log_debug(() => `added module imports '${module_name}'`); } function mono_wasm_lookup_js_import (function_name: string, js_module_name: string | null): Function { @@ -446,7 +446,7 @@ export function dynamic_import (module_name: string, module_url: string): Promis let promise = importedModulesPromises.get(module_name); const newPromise = !promise; if (newPromise) { - mono_log_debug(`importing ES6 module '${module_name}' from '${module_url}'`); + mono_log_debug(() => `importing ES6 module '${module_name}' from '${module_url}'`); promise = import(/*! webpackIgnore: true */module_url); importedModulesPromises.set(module_name, promise); } @@ -455,7 +455,7 @@ export function dynamic_import (module_name: string, module_url: string): Promis const module = await promise; if (newPromise) { importedModules.set(module_name, module); - mono_log_debug(`imported ES6 module '${module_name}' from '${module_url}'`); + mono_log_debug(() => `imported ES6 module '${module_name}' from '${module_url}'`); } return module; }); diff --git a/src/mono/browser/runtime/loader/assets.ts b/src/mono/browser/runtime/loader/assets.ts index 926042d57e7ddf..4d1d4a2b80a9e4 100644 --- a/src/mono/browser/runtime/loader/assets.ts +++ b/src/mono/browser/runtime/loader/assets.ts @@ -489,14 +489,14 @@ export async function start_asset_download (asset: AssetEntryInternal): Promise< // second attempt only after all first attempts are queued await loaderHelpers.allDownloadsQueued.promise; try { - mono_log_debug(`Retrying download '${asset.name}'`); + mono_log_debug(() => `Retrying download '${asset.name}'`); return await start_asset_download_with_throttle(asset); } catch (err) { asset.pendingDownloadInternal = undefined; // third attempt after small delay await delay(100); - mono_log_debug(`Retrying download (2) '${asset.name}' after delay`); + mono_log_debug(() => `Retrying download (2) '${asset.name}' after delay`); return await start_asset_download_with_throttle(asset); } } @@ -577,9 +577,9 @@ async function start_asset_download_sources (asset: AssetEntryInternal): Promise const attemptUrl = resolve_path(asset, sourcePrefix); if (asset.name === attemptUrl) { - mono_log_debug(`Attempting to download '${attemptUrl}'`); + mono_log_debug(() => `Attempting to download '${attemptUrl}'`); } else { - mono_log_debug(`Attempting to download '${attemptUrl}' for ${asset.name}`); + mono_log_debug(() => `Attempting to download '${attemptUrl}' for ${asset.name}`); } try { asset.resolvedUrl = attemptUrl; diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index ecb2b46bb1f1f8..3632969487868b 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -119,7 +119,7 @@ export function mono_exit (exit_code: number, reason?: any): void { unregisterEmscriptenExitHandlers(); uninstallUnhandledErrorHandler(); if (!runtimeHelpers.runtimeReady) { - mono_log_debug("abort_startup, reason: " + reason); + mono_log_debug(() => `abort_startup, reason: ${reason}`); abort_promises(reason); } else { if (runtimeHelpers.jiterpreter_dump_stats) { diff --git a/src/mono/browser/runtime/loader/libraryInitializers.ts b/src/mono/browser/runtime/loader/libraryInitializers.ts index a8a16c543dbccf..4dd0ccfed9ff25 100644 --- a/src/mono/browser/runtime/loader/libraryInitializers.ts +++ b/src/mono/browser/runtime/loader/libraryInitializers.ts @@ -18,7 +18,7 @@ export async function importLibraryInitializers (libraryInitializers: ResourceLi async function importInitializer (path: string): Promise { try { const adjustedPath = appendUniqueQuery(loaderHelpers.locateFile(path), "js-module-library-initializer"); - mono_log_debug(`Attempting to import '${adjustedPath}' for ${path}`); + mono_log_debug(() => `Attempting to import '${adjustedPath}' for ${path}`); const initializer = await import(/*! webpackIgnore: true */ adjustedPath); loaderHelpers.libraryInitializers!.push({ scriptName: path, exports: initializer }); diff --git a/src/mono/browser/runtime/loader/logging.ts b/src/mono/browser/runtime/loader/logging.ts index ce98616e08d0ee..e11e844c56b4d8 100644 --- a/src/mono/browser/runtime/loader/logging.ts +++ b/src/mono/browser/runtime/loader/logging.ts @@ -18,9 +18,12 @@ export function set_thread_prefix (threadPrefix: string) { threadNamePrefix = threadPrefix; } -export function mono_log_debug (msg: string, ...data: any[]) { +export function mono_log_debug (messageFactory: string | (() => string)) { if (loaderHelpers.diagnosticTracing) { - console.debug(prefix + msg, ...data); + const message = (typeof messageFactory === "function" + ? messageFactory() + : messageFactory); + console.debug(prefix + message); } } diff --git a/src/mono/browser/runtime/loader/run.ts b/src/mono/browser/runtime/loader/run.ts index 0bd2dd60d80852..663c7b930f68b9 100644 --- a/src/mono/browser/runtime/loader/run.ts +++ b/src/mono/browser/runtime/loader/run.ts @@ -423,14 +423,14 @@ function importModules () { if (typeof jsModuleRuntimeAsset.moduleExports === "object") { jsModuleRuntimePromise = jsModuleRuntimeAsset.moduleExports; } else { - mono_log_debug(`Attempting to import '${jsModuleRuntimeAsset.resolvedUrl}' for ${jsModuleRuntimeAsset.name}`); + mono_log_debug(() => `Attempting to import '${jsModuleRuntimeAsset.resolvedUrl}' for ${jsModuleRuntimeAsset.name}`); jsModuleRuntimePromise = import(/*! webpackIgnore: true */jsModuleRuntimeAsset.resolvedUrl!); } if (typeof jsModuleNativeAsset.moduleExports === "object") { jsModuleNativePromise = jsModuleNativeAsset.moduleExports; } else { - mono_log_debug(`Attempting to import '${jsModuleNativeAsset.resolvedUrl}' for ${jsModuleNativeAsset.name}`); + mono_log_debug(() => `Attempting to import '${jsModuleNativeAsset.resolvedUrl}' for ${jsModuleNativeAsset.name}`); jsModuleNativePromise = import(/*! webpackIgnore: true */jsModuleNativeAsset.resolvedUrl!); } diff --git a/src/mono/browser/runtime/logging.ts b/src/mono/browser/runtime/logging.ts index f6928320efba7b..7cd4af973fb889 100644 --- a/src/mono/browser/runtime/logging.ts +++ b/src/mono/browser/runtime/logging.ts @@ -15,9 +15,13 @@ export function set_thread_prefix (threadPrefix: string) { } /* eslint-disable no-console */ -export function mono_log_debug (msg: string, ...data: any) { + +export function mono_log_debug (messageFactory: string | (() => string)) { if (runtimeHelpers.diagnosticTracing) { - console.debug(prefix + msg, ...data); + const message = (typeof messageFactory === "function" + ? messageFactory() + : messageFactory); + console.debug(prefix + message); } } @@ -164,7 +168,7 @@ export function parseSymbolMapFile (text: string) { // may be never mono_assert(!wasm_pending_symbol_table, "Another symbol map was already loaded"); wasm_pending_symbol_table = text; - mono_log_debug(`Deferred loading of ${text.length}ch symbol map`); + mono_log_debug(() => `Deferred loading of ${text.length}ch symbol map`); } function performDeferredSymbolMapParsing () { @@ -197,7 +201,7 @@ function performDeferredSymbolMapParsing () { parts[1] = parts.splice(1).join(":"); wasm_func_map.set(Number(parts[0]), parts[1]); }); - mono_log_debug(`Loaded ${wasm_func_map.size} symbols`); + mono_log_debug(() => `Loaded ${wasm_func_map.size} symbols`); } catch (exc) { mono_log_warn(`Failed to load symbol map: ${exc}`); } diff --git a/src/mono/browser/runtime/pthreads/ui-thread.ts b/src/mono/browser/runtime/pthreads/ui-thread.ts index 94016a529424c5..505f1d81390706 100644 --- a/src/mono/browser/runtime/pthreads/ui-thread.ts +++ b/src/mono/browser/runtime/pthreads/ui-thread.ts @@ -258,7 +258,7 @@ function getNewWorker (modulePThread: PThreadLibrary): PThreadWorker { if (!WasmEnableThreads) return null as any; if (modulePThread.unusedWorkers.length == 0) { - mono_log_debug(`Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolInitialSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); + mono_log_debug(() => `Failed to find unused WebWorker, this may deadlock. Please increase the pthreadPoolInitialSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); const worker = allocateUnusedWorker(); modulePThread.loadWasmModuleToWorker(worker); return worker; @@ -277,7 +277,7 @@ function getNewWorker (modulePThread: PThreadLibrary): PThreadWorker { return worker; } } - mono_log_debug(`Failed to find loaded WebWorker, this may deadlock. Please increase the pthreadPoolInitialSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); + mono_log_debug(() => `Failed to find loaded WebWorker, this may deadlock. Please increase the pthreadPoolInitialSize. Running threads ${modulePThread.runningWorkers.length}. Loading workers: ${modulePThread.unusedWorkers.length}`); return modulePThread.unusedWorkers.pop()!; } diff --git a/src/mono/browser/runtime/pthreads/worker-thread.ts b/src/mono/browser/runtime/pthreads/worker-thread.ts index fa1269c300cb6f..75b249812d338f 100644 --- a/src/mono/browser/runtime/pthreads/worker-thread.ts +++ b/src/mono/browser/runtime/pthreads/worker-thread.ts @@ -65,7 +65,7 @@ export function initWorkerThreadEvents () { // this is the message handler for the worker that receives messages from the main thread // extend this with new cases as needed function monoDedicatedChannelMessageFromMainToWorker (event: MessageEvent): void { - mono_log_debug("got message from main on the dedicated channel", event.data); + mono_log_debug(() => `got message from main on the dedicated channel ${event.data}`); } export function on_emscripten_thread_init (pthread_ptr: PThreadPtr) { diff --git a/src/mono/browser/runtime/rollup.config.js b/src/mono/browser/runtime/rollup.config.js index 2588ad79d9ea19..83d4ca31223802 100644 --- a/src/mono/browser/runtime/rollup.config.js +++ b/src/mono/browser/runtime/rollup.config.js @@ -14,7 +14,7 @@ import gitCommitInfo from "git-commit-info"; import MagicString from "magic-string"; const configuration = process.env.Configuration; -const isDebug = configuration !== "Release"; +const isDebug = false; const isContinuousIntegrationBuild = process.env.ContinuousIntegrationBuild === "true" ? true : false; const productVersion = process.env.ProductVersion || "8.0.0-dev"; const nativeBinDir = process.env.NativeBinDir ? process.env.NativeBinDir.replace(/"/g, "") : "bin"; @@ -68,7 +68,18 @@ const inlineAssert = [ // eslint-disable-next-line quotes pattern: 'mono_assert\\(([^,]*), \\(\\) => *`([^`]*)`\\);', replacement: (match) => `if (!(${match[1]})) mono_assert(false, \`${match[2]}\`); // inlined mono_assert condition` - } + }, + { + // eslint-disable-next-line quotes + pattern: 'mono_log_debug\\(*"([^"]*)"\\);', + // eslint-disable-next-line quotes + replacement: (match) => `if (loaderHelpers.diagnosticTracing) mono_log_debug("${match[1]}"); // inlined mono_log_debug condition` + }, + { + // eslint-disable-next-line quotes + pattern: 'mono_log_debug\\(\\(\\) => *`([^`]*)`\\);', + replacement: (match) => `if (loaderHelpers.diagnosticTracing) mono_log_debug(\`${match[1]}\`); // inlined mono_log_debug condition` + }, ]; const checkAssert = {