diff options
author | Kim Alvefur <zash@zash.se> | 2016-02-21 19:29:31 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-02-21 19:29:31 +0100 |
commit | c82c00424dd2f8be24f75c7a0b7e786061477180 (patch) | |
tree | e41e94e9210400187a3b597bc1ffb0fa20b0fd0f /plugins | |
parent | b3b5222557fe854b3c0cc4abfad0a0ebb288fe01 (diff) | |
download | prosody-c82c00424dd2f8be24f75c7a0b7e786061477180.tar.gz prosody-c82c00424dd2f8be24f75c7a0b7e786061477180.zip |
mod_debug_sql: Small plugin that enables raw SQL query logging (for debugging)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_debug_sql.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/mod_debug_sql.lua b/plugins/mod_debug_sql.lua new file mode 100644 index 00000000..7bbbbd88 --- /dev/null +++ b/plugins/mod_debug_sql.lua @@ -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 + + |