Diff

net/xmppclient_listener.lua @ 585:033817e12ddb

Code tidying for xmpp{client,server}_listeners
author Matthew Wild <mwild1@gmail.com>
date Sat, 06 Dec 2008 23:16:46 +0000 (2008-12-06)
parent 565:3a49d85cafbc
child 597:e33d384e1b2e
line wrap: on
line diff
--- a/net/xmppclient_listener.lua	Sat Dec 06 23:15:48 2008 +0000
+++ b/net/xmppclient_listener.lua	Sat Dec 06 23:16:46 2008 +0000
@@ -47,7 +47,7 @@
 	end
 end
 
-local function handleerr(err) print("Traceback:", err, debug.traceback()); end
+local function handleerr(err) log("error", "Traceback[c2s]:", err, debug.traceback()); end
 function stream_callbacks.handlestanza(a, b)
 	xpcall(function () core_process_stanza(a, b) end, handleerr);
 end
@@ -116,25 +116,16 @@
 
 		-- Logging functions --
 
-		local mainlog, log = log;
-		do
-			local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$");
-			log = logger.init(conn_name);
-		end
-		local print = function (...) log("info", t_concatall({...}, "\t")); end
-		session.log = log;
-
-		print("Client connected");
+		local conn_name = "c2s"..tostring(conn):match("[a-f0-9]+$");
+		session.log = logger.init(conn_name);
+		
+		session.log("info", "Client connected");
 		
 		session.reset_stream = session_reset_stream;
 		session.close = session_close;
 		
 		session_reset_stream(session); -- Initialise, ready for use
 		
-		-- TODO: Below function should be session,stanza - and xmlhandlers should use :method() notation to call,
-		-- this will avoid the useless indirection we have atm
-		-- (I'm on a mission, no time to fix now)
-
 		-- Debug version --
 		--local function handleerr(err) print("Traceback:", err, debug.traceback()); end
 		--session.stanza_dispatch = function (stanza) return select(2, xpcall(function () return core_process_stanza(session, stanza); end, handleerr));  end