Changeset

8721:b773b15fee71

util.startup: Set up event hooks for reloading logging here instead of in loggingmanager to simplify startup dependencies
author Kim Alvefur <zash@zash.se>
date Thu, 05 Apr 2018 17:53:51 +0200
parents 8720:dba17a70fd22
children 8722:7ee93b3fa160
files core/loggingmanager.lua util/startup.lua
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/core/loggingmanager.lua	Thu Apr 05 17:52:37 2018 +0200
+++ b/core/loggingmanager.lua	Thu Apr 05 17:53:51 2018 +0200
@@ -18,7 +18,6 @@
 
 local config = require "core.configmanager";
 local logger = require "util.logger";
-local prosody = prosody;
 
 local _ENV = nil;
 -- luacheck: std none
@@ -152,13 +151,8 @@
 	for name, sink_maker in pairs(old_sink_types) do
 		log_sink_types[name] = sink_maker;
 	end
-
-	prosody.events.fire_event("logging-reloaded");
 end
 
-reload_logging();
-prosody.events.add_handler("reopen-log-files", reload_logging);
-
 --- Definition of built-in logging sinks ---
 
 -- Null sink, must enter log_sink_types *first*
--- a/util/startup.lua	Thu Apr 05 17:52:37 2018 +0200
+++ b/util/startup.lua	Thu Apr 05 17:53:51 2018 +0200
@@ -84,7 +84,12 @@
 
 function startup.init_logging()
 	-- Initialize logging
-	require "core.loggingmanager"
+	local loggingmanager = require "core.loggingmanager"
+	loggingmanager.reload_logging();
+	prosody.events.add_handler("reopen-log-files", function ()
+		loggingmanager.reload_logging();
+		prosody.events.fire_event("logging-reloaded");
+	end);
 end
 
 function startup.log_dependency_warnings()