Log event path along with timing in EventHook.call

This commit is contained in:
jesopo 2018-08-28 16:35:24 +01:00
parent 672b22e62c
commit b47bf49830

View file

@ -117,8 +117,9 @@ class EventHook(object):
def call_limited(self, maximum, **kwargs): def call_limited(self, maximum, **kwargs):
return self._call(kwargs, maximum=maximum) return self._call(kwargs, maximum=maximum)
def _call(self, kwargs, maximum=None): def _call(self, kwargs, maximum=None):
event_path = self._get_path()
self.bot.log.debug("calling event: \"%s\" (params: %s)", self.bot.log.debug("calling event: \"%s\" (params: %s)",
[self._get_path(), kwargs]) [event_path, kwargs])
start = time.monotonic() start = time.monotonic()
event = self._make_event(kwargs) event = self._make_event(kwargs)
@ -144,7 +145,8 @@ class EventHook(object):
end = time.monotonic() end = time.monotonic()
total_milliseconds = (end - start) * 1000 total_milliseconds = (end - start) * 1000
self.bot.log.debug("event called in %fms", [total_milliseconds]) self.bot.log.debug("event \"%s\" called in %fms", [
event_path, total_milliseconds])
self.check_purge() self.check_purge()