#208 - Added a time limits for regex matchers

This commit is contained in:
Simon Cambier
2023-03-12 11:30:56 +01:00
parent 2b2709d9ab
commit 23640f4b0b
3 changed files with 37 additions and 14 deletions

View File

@@ -325,8 +325,18 @@ export function splitCamelCase(text: string): string[] {
return text.replace(/([a-z](?=[A-Z]))/g, '$1 ').split(' ')
}
export function logDebug(...attr: any[]): void {
export function logDebug(...args: any[]): void {
printDebug(console.log, ...args)
}
export function warnDebug(...args: any[]): void {
printDebug(console.warn, ...args)
}
function printDebug(fn: (...args: any[]) => any, ...args: any[]): void {
if (settings.verboseLogging) {
console.log(...['Omnisearch -', ...attr])
const t = new Date()
const ts = `${t.getMinutes()}:${t.getSeconds()}:${t.getMilliseconds()}`
fn(...['Omnisearch -', ts + ' -', ...args])
}
}