changeset 2849:5e74028557dc

mod_log_slow_events: Turn into a shared module (fixes http events being logged multiple times)
author Kim Alvefur <zash@zash.se>
date Tue, 21 Nov 2017 23:00:21 +0100 (2017-11-21)
parents 232da6b1d2c1
children 3ba8fd1a297e
files mod_log_slow_events/mod_log_slow_events.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_log_slow_events/mod_log_slow_events.lua	Tue Nov 21 16:58:50 2017 +0100
+++ b/mod_log_slow_events/mod_log_slow_events.lua	Tue Nov 21 23:00:21 2017 +0100
@@ -1,3 +1,5 @@
+module:set_global();
+
 local time = require "socket".gettime;
 local base64_decode = require "util.encodings".base64.decode;
 
@@ -52,7 +54,9 @@
 	return ret;
 end
 
-module:wrap_event(false, event_wrapper);
 local http_events = require "net.http.server"._events;
 module:wrap_object_event(http_events, false, event_wrapper);
 
+function module.add_host(module)
+	module:wrap_event(false, event_wrapper);
+end