Changeset

2917:cd5e6534b813

mod_storage_xmlarchive: Add additional debug logging
author Kim Alvefur <zash@zash.se>
date Fri, 09 Mar 2018 21:58:47 +0100
parents 2916:b1cdcbcd1c90
children 2918:d2d0715f30d9
files mod_storage_xmlarchive/mod_storage_xmlarchive.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Fri Mar 09 13:35:44 2018 +0000
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Fri Mar 09 21:58:47 2018 +0100
@@ -64,7 +64,7 @@
 	local date = id:sub(1, 10);
 	for d = 1, #dates do
 		if date == dates[d] then
-			module:log("debug", "Loading items from %s", dates[d]);
+			module:log("debug", "Loading index for %s", dates[d]);
 			local items = dm.list_load(username .. "@" .. dates[d], self.host, self.store) or empty;
 			for i = 1, #items do
 				if items[i].id == id then
@@ -154,6 +154,7 @@
 	local date_open, xmlfile;
 	local function read_xml(date, offset, length)
 		if xmlfile and date ~= date_open then
+			module:log("debug", "Closing XML file for %s", date_open);
 			xmlfile:close();
 			xmlfile = nil;
 		end
@@ -166,6 +167,7 @@
 				module:log("error", "Error: %s", ferr);
 				return nil, ferr;
 			end
+			module:log("debug", "Opened XML file %s", filename);
 		end
 		local pos, err = xmlfile:seek("set", offset);
 		if pos ~= offset then
@@ -179,7 +181,7 @@
 		for d = start_day, last_day, step do
 			local date = dates[d];
 			if not items then
-				module:log("debug", "Loading items from %s", date);
+				module:log("debug", "Loading index for %s", date);
 				start_day = d;
 				items = dm.list_load(username .. "@" .. date, self.host, self.store) or empty;
 				if not rev then
@@ -269,6 +271,7 @@
 end
 
 function archive:dates(username)
+	module:log("debug", "Loading root index for %s", username);
 	local dates, err = dm.list_load(username, self.host, self.store);
 	if not dates then return dates, err; end
 	assert(type(dates[1]) == "string" and type(dates[#dates]) == "string",