feat: add debug message throttle
This commit is contained in:
+13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user