commands.lua: prevent infinite logging with debug log level

With -v -v there was an infinite loop of log messages, because every new
logged script message to console triggers a new script message, which
gets logged again.
This commit is contained in:
Guido Cella authored and Kacper Michajłow committed 2025-03-23 22:56:39 +01:00
1 parent 958fee6895
commit b31c3d80ab
1 file changed
+6
+6
View File
@@ -590,6 +590,12 @@ mp.register_event("log-message", function(e)
-- OSD display itself.
if e.level == "trace" then return end
-- Avoid logging debug messages infinitely.
if e.prefix == "cplayer" and
e.text:find('^Run command: script%-message%-to, flags=64, args=%[target="console"') then
return
end
-- Use color for debug/v/warn/error/fatal messages.
input.log("[" .. e.prefix .. "] " .. e.text:sub(1, -2), styles[e.level],
terminal_styles[e.level])