fix loopCount debug to actually log

This commit is contained in:
Ean Milligan 2025-08-05 17:59:03 -04:00
parent e06abac9cf
commit 1bb8c1a308
2 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import { QueuedRoll } from 'artigen/managers/manager.d.ts';
import { loggingEnabled, loopLoggingEnabled } from 'artigen/utils/logFlag.ts'; import { loggingEnabled, loopLoggingEnabled } from 'artigen/utils/logFlag.ts';
(loggingEnabled || loopLoggingEnabled) && initLog('logs/worker', loggingEnabled || loopLoggingEnabled); if (loggingEnabled || loopLoggingEnabled) initLog('logs/worker', loggingEnabled || loopLoggingEnabled);
// Extend the BigInt prototype to support JSON.stringify // Extend the BigInt prototype to support JSON.stringify
interface BigIntX extends BigInt { interface BigIntX extends BigInt {
@ -45,6 +45,6 @@ self.onmessage = async (e: MessageEvent<QueuedRoll>) => {
}, },
}; };
self.postMessage(returnMsg); self.postMessage(returnMsg);
loggingEnabled && (await closeLog()); if (loggingEnabled || loopLoggingEnabled) await closeLog();
self.close(); self.close();
}; };

View File

@ -11,7 +11,7 @@ import { loggingEnabled } from 'artigen/utils/logFlag.ts';
export const escapeCharacters = (str: string, esc: string): string => { export const escapeCharacters = (str: string, esc: string): string => {
// Loop thru each esc char one at a time // Loop thru each esc char one at a time
for (const e of esc) { for (const e of esc) {
loopCountCheck('escape.ts - escaping characters'); loopCountCheck(`escape.ts - escaping character ${e}`);
loggingEnabled && log(LT.LOG, `Escaping character ${e} | ${str}, ${esc}`); loggingEnabled && log(LT.LOG, `Escaping character ${e} | ${str}, ${esc}`);
// Create a new regex to look for that char that needs replaced and escape it // Create a new regex to look for that char that needs replaced and escape it