Hey,

We noticed there was no time stamp in the logs so we wrote this patch that 
does it.
The new option should be added to the prosody.cfg.lua:

Example:
message_logging_timestamp_format = "%F %T"

If not set, the default behavior will be the former.

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To post to this group, send email to prosody-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.
--- mod_message_logging.lua	2014-05-05 13:00:52.211901820 -0400
+++ mod_message_logging.lua.new	2014-05-05 12:59:53.166795155 -0400
@@ -16,6 +16,9 @@
 local log_base_path = module:get_option("message_logging_dir", prosody.paths.data.."/message_logs");
 mkdir(log_base_path);
 
+local log_timestamp_format = module:get_option("message_logging_timestamp_format", false);
+ 
+
 local function get_host_path(host)
 	return log_base_path.."/"..fsencode(host);
 end
@@ -68,7 +71,7 @@
 		from = from.." <"..(select(3, jid_split(stanza.attr.from)) or "")..">";
 	end
 	body = body:gsub("\n", "\n    "); -- Indent newlines
-	f:write("RECV: ", from, ": ", body, "\n");
+	f:write( ( log_timestamp_format and os.date(log_timestamp_format) .. " " or ""), "RECV: ", from, ": ", body, "\n");
 	f:flush();
 end
 
@@ -86,7 +89,7 @@
 	local f = open_files[from];
 	if not f then return; end
 	body = body:gsub("\n", "\n    "); -- Indent newlines
-	f:write("SEND: ", to, ": ", body, "\n");
+	f:write( ( log_timestamp_format and os.date(log_timestamp_format) .. " " or ""), "SEND: ", to, ": ", body, "\n");
 	f:flush();
 end
 

Reply via email to