core/hostmanager.lua
changeset 6709 60c692828cf6
parent 6621 469151b08065
child 6724 3807af36d773
child 6782 6236668da30a
--- a/core/hostmanager.lua	Fri May 15 15:32:39 2015 +0200
+++ b/core/hostmanager.lua	Mon May 18 20:50:50 2015 +0200
@@ -26,9 +26,23 @@
 
 local pairs, select, rawget = pairs, select, rawget;
 local tostring, type = tostring, type;
+local setmetatable = setmetatable;
 
 module "hostmanager"
 
+local host_mt = { }
+function host_mt:__tostring()
+	if self.type == "component" then
+		local typ = configmanager.get(self.host, "component_module");
+		if typ == "component" then
+			return ("Component %q"):format(self.host);
+		end
+		return ("Component %q %q"):format(self.host, typ);
+	elseif self.type == "local" then
+		return ("VirtualHost %q"):format(self.host);
+	end
+end
+
 local hosts_loaded_once;
 
 local function load_enabled_hosts(config)
@@ -76,6 +90,7 @@
 		send = host_send;
 		modules = {};
 	};
+	setmetatable(host_session, host_mt);
 	if not host_config.component_module then -- host
 		host_session.type = "local";
 		host_session.sessions = {};