0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 02:53:49 +01:00

More changes to log messages.

This commit is contained in:
Wouter R 2014-05-12 13:46:38 +02:00
parent b29eb5289e
commit bca5228b73
5 changed files with 17 additions and 17 deletions

View File

@ -130,11 +130,11 @@ function M:addPostResponseFunction(fn)
table.insert(self.postResponseQueue, fn)
end
--- Call all function on the post-response queue, see @{M:addPostResponseFunction} for details and a side-note.
--- Call all functions on the post-response queue, see @{M:addPostResponseFunction} for details and a side-note.
function M:executePostResponseQueue()
--log:info(MOD_ABBR, "Response:executePostResponseQueue: " .. utils.dump(self.postResponseQueue))
log:verbose(MOD_ABBR, "Response:executePostResponseQueue: " .. utils.dump(self.postResponseQueue))
for i,fn in ipairs(self.postResponseQueue) do fn() end
for i,fn in ipairs(self.postResponseQueue) do fn() end
end
--- Returns an API url pointing to @{conf_defaults.API_BASE_URL_PATH}, which is quite useless.
@ -153,7 +153,7 @@ function M:serializeAsJson()
return JSON:encode(self.body)
end
--- Writes HTTP headers, followed by an HTTP body containing JSON data to stdout.
--- Writes HTTP headers to stdout, followed by an HTTP body containing either JSON data or a file attachment.
function M:send()
printHeaderLine("Status", self.httpStatusCode .. " " .. self.httpStatusText)
printHeaderLine("Content-Type", self.contentType)
@ -170,7 +170,7 @@ function M:send()
end
if self.body.status ~= "success" then
log:verbose(MOD_ABBR, "Response:"..utils.dump(self.body.status).." ("..utils.dump(self.body.msg)..")")
log:verbose(MOD_ABBR, "Response: "..utils.dump(self.body.status).." ("..utils.dump(self.body.msg)..")")
end
end

View File

@ -43,7 +43,7 @@ end
function M.getController()
local file, error = io.open('/tmp/controller.txt','r')
if file == nil then
--log:error(MOD_ABBR, "Util:Access:Can't read controller file. Error: "..error)
--log:error(MOD_ABBR, "Util:Access: Can't read controller file. Error: "..error)
return ""
else
controllerIP = file:read('*a')

View File

@ -83,7 +83,7 @@ end
--returns a printer instance or nil (and sets error state on response in the latter case)
function M.createPrinterOrFail(deviceId, response)
--log:verbose(MOD_ABBR, "API:printer:createPrinterOrFail: "..utils.dump(deviceId))
--log:info(MOD_ABBR, "API:printer:createPrinterOrFail: "..utils.dump(deviceId))
local rv,msg,printer = nil, nil, nil
if deviceId == nil or deviceId == "" then

View File

@ -179,7 +179,7 @@ function M.get(key)
local uciV,msg = uci:get(UCI_CONFIG_NAME, section, key)
if not uciV and msg ~= nil then
local errorMSG = "Issue reading setting '"..utils.dump(key).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
@ -246,14 +246,14 @@ end
-- @treturn bool|nil True if everything went well, false if validation error, nil in case of error.
-- @treturn ?string Error message in case first return value is nil (invalid key).
function M.set(key, value, noCommit)
log:info(MOD_ABBR, "settings:set: "..utils.dump(key).." to: "..utils.dump(value))
--log:info(MOD_ABBR, "settings:set: "..utils.dump(key).." to: "..utils.dump(value))
key = replaceDots(key)
local r = utils.create(UCI_CONFIG_FILE)
local rv, msg = uci:set(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, UCI_CONFIG_TYPE)
if not rv and msg ~= nil then
local errorMSG = "Issue creating section '"..utils.dump(UCI_CONFIG_SECTION).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
@ -285,7 +285,7 @@ function M.set(key, value, noCommit)
local rv, msg = uci:set(UCI_CONFIG_NAME, section, UCI_CONFIG_TYPE)
if not rv and msg ~= nil then
local errorMSG = "Issue getting subsection '"..utils.dump(base.subSection).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
end
@ -294,14 +294,14 @@ function M.set(key, value, noCommit)
local rv, msg = uci:set(UCI_CONFIG_NAME, section, key, toUciValue(value, base.type))
if not rv and msg ~= nil then
local errorMSG = "Issue setting setting '"..utils.dump(key).."' in section '"..utils.dump(section).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
else
local rv, msg = uci:delete(UCI_CONFIG_NAME, section, key)
if not rv and msg ~= nil then
local errorMSG = "Issue deleting setting '"..utils.dump(key).."' in section '"..utils.dump(section).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
end
@ -326,7 +326,7 @@ function M.resetAll()
local allSections, msg = uci:get_all(UCI_CONFIG_NAME)
if not allSections and msg ~= nil then
local errorMSG = "Issue reading all settings: "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
@ -336,7 +336,7 @@ function M.resetAll()
local rv, msg = uci:delete(UCI_CONFIG_NAME,key)
if not rv and msg ~= nil then
local errorMSG = "Issue deleting setting '"..utils.dump(key).."': "..utils.dump(msg);
log:info(MOD_ABBR, errorMSG)
log:warning(MOD_ABBR, errorMSG)
return nil, errorMSG;
end
end
@ -373,7 +373,7 @@ function M.reset(key, noCommit)
-- (which always happens when reset is used in resetall) it will also generate a error
--if not rv and msg ~= nil then
-- local errorMSG = "Issue deleting setting '"..utils.dump(key).."' in section '"..section.."': "..utils.dump(msg);
-- log:info(MOD_ABBR, errorMSG)
-- log:warning(MOD_ABBR, errorMSG)
-- return nil, errorMSG;
--end

View File

@ -25,7 +25,7 @@ function M.get(fileName)
local path = getPath(fileName)
local file, error = io.open(path,'r')
if file == nil then
--log:error(MOD_ABBR, "Util:Access:Can't read controller file. Error: "..error)
--log:warning(MOD_ABBR, "Util:Access:Can't read controller file. Error: "..error)
return "",""
else
local status = file:read('*a')