Changeset

1076:ba3639692493

sessionmanager: Miscellaneous logging improvements, changing levels, improving messages and using session loggers where possible
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Apr 2009 02:45:10 +0100
parents 1075:831c84cbf5fa
children 1077:d6a885cacd8c
files core/sessionmanager.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Thu Apr 30 02:43:12 2009 +0100
+++ b/core/sessionmanager.lua	Thu Apr 30 02:45:10 2009 +0100
@@ -45,7 +45,7 @@
 		getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; end;
 	end
 	open_sessions = open_sessions + 1;
-	log("info", "open sessions now: ".. open_sessions);
+	log("debug", "open sessions now: ".. open_sessions);
 	local w = conn.write;
 	session.send = function (t) w(tostring(t)); end
 	session.ip = conn.ip();
@@ -53,7 +53,7 @@
 end
 
 function destroy_session(session, err)
-	(session.log or log)("info", "Destroying session");
+	(session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)");
 	
 	-- Send unavailable presence
 	if session.presence then
@@ -94,6 +94,7 @@
 	if session.type == "c2s_unauthed" then
 		session.type = "c2s";
 	end
+	session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)");
 	return true;
 end
 
@@ -176,7 +177,7 @@
 	
 	send(features);
 	
-	(session.log or log)("info", "Sent reply <stream:stream> to client");
+	(session.log or log)("debug", "Sent reply <stream:stream> to client");
 	session.notopen = nil;
 end