Changeset

1684:645e18990211

core.sessionmanager, xmppclient_listener: Move responsibility for setting session.log to the former from the latter, much more sensible
author Matthew Wild <mwild1@gmail.com>
date Sun, 16 Aug 2009 21:34:53 +0100
parents 1683:a73b0557d87a
children 1685:f5e24a63d233
files core/sessionmanager.lua net/xmppclient_listener.lua
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Sun Aug 16 21:32:10 2009 +0100
+++ b/core/sessionmanager.lua	Sun Aug 16 21:34:53 2009 +0100
@@ -19,7 +19,8 @@
 local bare_sessions = bare_sessions;
 
 local modulemanager = require "core.modulemanager";
-local log = require "util.logger".init("sessionmanager");
+local logger = require "util.logger";
+local log = logger.init("sessionmanager");
 local error = error;
 local uuid_generate = require "util.uuid".generate;
 local rm_load_roster = require "core.rostermanager".load_roster;
@@ -50,6 +51,9 @@
 	local w = conn.write;
 	session.send = function (t) w(tostring(t)); end
 	session.ip = conn.ip();
+	local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$");
+	session.log = logger.init(conn_name);
+		
 	return session;
 end
 
--- a/net/xmppclient_listener.lua	Sun Aug 16 21:32:10 2009 +0100
+++ b/net/xmppclient_listener.lua	Sun Aug 16 21:34:53 2009 +0100
@@ -116,9 +116,6 @@
 
 		-- Logging functions --
 
-		local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$");
-		session.log = logger.init(conn_name);
-		
 		session.log("info", "Client connected");
 		
 		-- Client is using legacy SSL (otherwise mod_tls sets this flag)