Changeset

1069:034e345c0f8d

modulemanager: Update logger when a module becomes global
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Apr 2009 01:36:46 +0100
parents 1067:21f41b06f1d2
children 1070:3b066968063b
files core/modulemanager.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Wed Apr 29 20:52:24 2009 +0100
+++ b/core/modulemanager.lua	Thu Apr 30 01:36:46 2009 +0100
@@ -123,6 +123,10 @@
 	-- Use modified host, if the module set one
 	modulemap[api_instance.host][module_name] = pluginenv;
 	
+	if api_instance.host == "*" and host ~= "*" then
+		api_instance:set_global();
+	end
+		
 	return true;
 end
 
@@ -260,6 +264,10 @@
 
 function api:set_global()
 	self.host = "*";
+	-- Update the logger
+	local _log = logger.init("mod_"..self.name);
+	self.log = function (self, ...) return _log(...); end;
+	self._log = _log;
 end
 
 local function _add_handler(module, origin_type, tag, xmlns, handler)