diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-07-23 17:32:33 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-07-23 17:32:33 +0100 |
commit | e89b006f03f692a7e807c54757f0623302c40b85 (patch) | |
tree | 9c9c3219211b2f9e2eca26d188f9f44924922db7 /util | |
parent | badc4159d600642f97d064a7f74c2ff68dda8abf (diff) | |
download | prosody-e89b006f03f692a7e807c54757f0623302c40b85.tar.gz prosody-e89b006f03f692a7e807c54757f0623302c40b85.zip |
Hopefully inert commit to clean up logging across a number of modules, removing all cases of concatenation when building log messages
Diffstat (limited to 'util')
-rw-r--r-- | util/datamanager.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index a5d676cc..30c1e298 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -115,18 +115,18 @@ function load(username, host, datastore) if not data then local mode = lfs.attributes(getpath(username, host, datastore), "mode"); if not mode then - log("debug", "Assuming empty "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil; else -- file exists, but can't be read -- TODO more detailed error checking and logging? - log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil, "Error reading storage"; end end setfenv(data, {}); local success, ret = pcall(data); if not success then - log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Unable to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil, "Error reading storage"; end return ret; @@ -145,7 +145,7 @@ function store(username, host, datastore, data) -- save the datastore local f, msg = io_open(getpath(username, host, datastore, nil, true), "w+"); if not f then - log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); return nil, "Error saving to storage"; end f:write("return "); @@ -166,7 +166,7 @@ function list_append(username, host, datastore, data) -- save the datastore local f, msg = io_open(getpath(username, host, datastore, "list", true), "a+"); if not f then - log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); return; end f:write("item("); @@ -184,7 +184,7 @@ function list_store(username, host, datastore, data) -- save the datastore local f, msg = io_open(getpath(username, host, datastore, "list", true), "w+"); if not f then - log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Unable to write to %s storage ('%s') for user: %s@%s", datastore, msg, username or "nil", host or "nil"); return; end for _, d in ipairs(data) do @@ -207,11 +207,11 @@ function list_load(username, host, datastore) if not data then local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode"); if not mode then - log("debug", "Assuming empty "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil; else -- file exists, but can't be read -- TODO more detailed error checking and logging? - log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil, "Error reading storage"; end end @@ -219,7 +219,7 @@ function list_load(username, host, datastore) setfenv(data, {item = function(i) t_insert(items, i); end}); local success, ret = pcall(data); if not success then - log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); + log("error", "Unable to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil"); return nil, "Error reading storage"; end return items; |