mod_log_events: Module to log all events on the server/host
authorMatthew Wild <mwild1@gmail.com>
Tue, 31 Mar 2015 12:44:28 +0100
changeset 1641 9276473ee5be
parent 1639 b877b75eb973
child 1642 398c4aaccf6d
mod_log_events: Module to log all events on the server/host
mod_log_events/mod_log_events.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_log_events/mod_log_events.lua	Tue Mar 31 12:44:28 2015 +0100
@@ -0,0 +1,13 @@
+module:set_global();
+
+local helpers = require "util.helpers";
+
+helpers.log_events(prosody.events, "global", module._log);
+
+function module.add_host(module)
+	helpers.log_events(prosody.hosts[module.host].events, module.host, module._log);
+end
+
+function module.remove_host(module)
+	helpers.revert_log_events(prosody.hosts[module.host].events);
+end