mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
More changes to log messages.
This commit is contained in:
parent
b29eb5289e
commit
bca5228b73
@ -130,9 +130,9 @@ function M:addPostResponseFunction(fn)
|
|||||||
table.insert(self.postResponseQueue, fn)
|
table.insert(self.postResponseQueue, fn)
|
||||||
end
|
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()
|
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
|
end
|
||||||
@ -153,7 +153,7 @@ function M:serializeAsJson()
|
|||||||
return JSON:encode(self.body)
|
return JSON:encode(self.body)
|
||||||
end
|
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()
|
function M:send()
|
||||||
printHeaderLine("Status", self.httpStatusCode .. " " .. self.httpStatusText)
|
printHeaderLine("Status", self.httpStatusCode .. " " .. self.httpStatusText)
|
||||||
printHeaderLine("Content-Type", self.contentType)
|
printHeaderLine("Content-Type", self.contentType)
|
||||||
|
@ -83,7 +83,7 @@ end
|
|||||||
--returns a printer instance or nil (and sets error state on response in the latter case)
|
--returns a printer instance or nil (and sets error state on response in the latter case)
|
||||||
function M.createPrinterOrFail(deviceId, response)
|
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
|
local rv,msg,printer = nil, nil, nil
|
||||||
|
|
||||||
if deviceId == nil or deviceId == "" then
|
if deviceId == nil or deviceId == "" then
|
||||||
|
@ -179,7 +179,7 @@ function M.get(key)
|
|||||||
local uciV,msg = uci:get(UCI_CONFIG_NAME, section, key)
|
local uciV,msg = uci:get(UCI_CONFIG_NAME, section, key)
|
||||||
if not uciV and msg ~= nil then
|
if not uciV and msg ~= nil then
|
||||||
local errorMSG = "Issue reading setting '"..utils.dump(key).."': "..utils.dump(msg);
|
local errorMSG = "Issue reading setting '"..utils.dump(key).."': "..utils.dump(msg);
|
||||||
log:info(MOD_ABBR, errorMSG)
|
log:warning(MOD_ABBR, errorMSG)
|
||||||
return nil, errorMSG;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -246,14 +246,14 @@ end
|
|||||||
-- @treturn bool|nil True if everything went well, false if validation error, nil in case of error.
|
-- @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).
|
-- @treturn ?string Error message in case first return value is nil (invalid key).
|
||||||
function M.set(key, value, noCommit)
|
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)
|
key = replaceDots(key)
|
||||||
|
|
||||||
local r = utils.create(UCI_CONFIG_FILE)
|
local r = utils.create(UCI_CONFIG_FILE)
|
||||||
local rv, msg = uci:set(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, UCI_CONFIG_TYPE)
|
local rv, msg = uci:set(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, UCI_CONFIG_TYPE)
|
||||||
if not rv and msg ~= nil then
|
if not rv and msg ~= nil then
|
||||||
local errorMSG = "Issue creating section '"..utils.dump(UCI_CONFIG_SECTION).."': "..utils.dump(msg);
|
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;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ function M.set(key, value, noCommit)
|
|||||||
local rv, msg = uci:set(UCI_CONFIG_NAME, section, UCI_CONFIG_TYPE)
|
local rv, msg = uci:set(UCI_CONFIG_NAME, section, UCI_CONFIG_TYPE)
|
||||||
if not rv and msg ~= nil then
|
if not rv and msg ~= nil then
|
||||||
local errorMSG = "Issue getting subsection '"..utils.dump(base.subSection).."': "..utils.dump(msg);
|
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;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
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))
|
local rv, msg = uci:set(UCI_CONFIG_NAME, section, key, toUciValue(value, base.type))
|
||||||
if not rv and msg ~= nil then
|
if not rv and msg ~= nil then
|
||||||
local errorMSG = "Issue setting setting '"..utils.dump(key).."' in section '"..utils.dump(section).."': "..utils.dump(msg);
|
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;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local rv, msg = uci:delete(UCI_CONFIG_NAME, section, key)
|
local rv, msg = uci:delete(UCI_CONFIG_NAME, section, key)
|
||||||
if not rv and msg ~= nil then
|
if not rv and msg ~= nil then
|
||||||
local errorMSG = "Issue deleting setting '"..utils.dump(key).."' in section '"..utils.dump(section).."': "..utils.dump(msg);
|
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;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -326,7 +326,7 @@ function M.resetAll()
|
|||||||
local allSections, msg = uci:get_all(UCI_CONFIG_NAME)
|
local allSections, msg = uci:get_all(UCI_CONFIG_NAME)
|
||||||
if not allSections and msg ~= nil then
|
if not allSections and msg ~= nil then
|
||||||
local errorMSG = "Issue reading all settings: "..utils.dump(msg);
|
local errorMSG = "Issue reading all settings: "..utils.dump(msg);
|
||||||
log:info(MOD_ABBR, errorMSG)
|
log:warning(MOD_ABBR, errorMSG)
|
||||||
return nil, errorMSG;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ function M.resetAll()
|
|||||||
local rv, msg = uci:delete(UCI_CONFIG_NAME,key)
|
local rv, msg = uci:delete(UCI_CONFIG_NAME,key)
|
||||||
if not rv and msg ~= nil then
|
if not rv and msg ~= nil then
|
||||||
local errorMSG = "Issue deleting setting '"..utils.dump(key).."': "..utils.dump(msg);
|
local errorMSG = "Issue deleting setting '"..utils.dump(key).."': "..utils.dump(msg);
|
||||||
log:info(MOD_ABBR, errorMSG)
|
log:warning(MOD_ABBR, errorMSG)
|
||||||
return nil, errorMSG;
|
return nil, errorMSG;
|
||||||
end
|
end
|
||||||
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
|
-- (which always happens when reset is used in resetall) it will also generate a error
|
||||||
--if not rv and msg ~= nil then
|
--if not rv and msg ~= nil then
|
||||||
-- local errorMSG = "Issue deleting setting '"..utils.dump(key).."' in section '"..section.."': "..utils.dump(msg);
|
-- 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;
|
-- return nil, errorMSG;
|
||||||
--end
|
--end
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ function M.get(fileName)
|
|||||||
local path = getPath(fileName)
|
local path = getPath(fileName)
|
||||||
local file, error = io.open(path,'r')
|
local file, error = io.open(path,'r')
|
||||||
if file == nil then
|
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 "",""
|
return "",""
|
||||||
else
|
else
|
||||||
local status = file:read('*a')
|
local status = file:read('*a')
|
||||||
|
Loading…
Reference in New Issue
Block a user