Comparison

util/helpers.lua @ 5415:9e7aa5b47bdf

util.helpers: Helper helpers to log host events
author Matthew Wild <mwild1@gmail.com>
date Wed, 03 Apr 2013 13:39:00 +0100
parent 4705:447f5a94792d
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5414:efec29eb4cdd 5415:9e7aa5b47bdf
11 module("helpers", package.seeall); 11 module("helpers", package.seeall);
12 12
13 -- Helper functions for debugging 13 -- Helper functions for debugging
14 14
15 local log = require "util.logger".init("util.debug"); 15 local log = require "util.logger".init("util.debug");
16
17 function log_host_events(host)
18 return log_events(prosody.hosts[host].events, host);
19 end
20
21 function revert_log_host_events(host)
22 return revert_log_events(prosody.hosts[host].events);
23 end
16 24
17 function log_events(events, name, logger) 25 function log_events(events, name, logger)
18 local f = events.fire_event; 26 local f = events.fire_event;
19 if not f then 27 if not f then
20 error("Object does not appear to be a util.events object"); 28 error("Object does not appear to be a util.events object");