mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
This commit is contained in:
parent
b3b5222557
commit
c82c00424d
1 changed files with 25 additions and 0 deletions
25
plugins/mod_debug_sql.lua
Normal file
25
plugins/mod_debug_sql.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
-- Enables SQL query logging
|
||||
--
|
||||
-- luacheck: ignore 213/uri
|
||||
|
||||
local engines = module:shared("/*/sql/connections");
|
||||
|
||||
for uri, engine in pairs(engines) do
|
||||
engine:debug(true);
|
||||
end
|
||||
|
||||
setmetatable(engines, {
|
||||
__newindex = function (t, uri, engine)
|
||||
engine:debug(true);
|
||||
rawset(t, uri, engine);
|
||||
end
|
||||
});
|
||||
|
||||
function module.unload()
|
||||
setmetatable(engines, nil);
|
||||
for uri, engine in pairs(engines) do
|
||||
engine:debug(false);
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue