feat: add debug message throttle

This commit is contained in:
Xurkon
2026-06-06 13:44:49 -05:00
parent 31bd1e7d9b
commit 2cb129ae4b
6 changed files with 117 additions and 0 deletions
+13
View File
@@ -1,4 +1,7 @@
local band = bit.band
local debugThrottleState = {
lastPrint = nil,
}
-------------------------
--Import modules.
@@ -169,6 +172,16 @@ function Questie:Debug(msgDebugLevel, ...)
return
end
local throttleSeconds = tonumber(Questie.db and Questie.db.profile and Questie.db.profile.debugMessageThrottle) or 0
local now = GetTime and GetTime() or time()
if throttleSeconds > 0 and debugThrottleState.lastPrint and (now - debugThrottleState.lastPrint) < throttleSeconds then
return
end
if throttleSeconds > 0 then
debugThrottleState.lastPrint = now
end
local prefix = ""
if (band(msgDebugLevel, Questie.DEBUG_CRITICAL) ~= 0) then prefix = prefix .. "|cff00f2e6[CRITICAL]|r " end
if (band(msgDebugLevel, Questie.DEBUG_ELEVATED) ~= 0) then prefix = prefix .. "|cffebf441[ELEVATED]|r " end