mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-11-05 06:03:23 +01:00
Logging:
- log only one line when signing in; - change level of UCI/init.d changes from info to verbose; - change log level of network:getStatus message from info to verbose.
This commit is contained in:
parent
b4aa1a9746
commit
65062207ff
@ -64,7 +64,7 @@ function M.switchConfiguration(components)
|
|||||||
for k,v in pairs(components) do
|
for k,v in pairs(components) do
|
||||||
local fname = k .. '_' .. v
|
local fname = k .. '_' .. v
|
||||||
if type(reconf[fname]) == 'function' then
|
if type(reconf[fname]) == 'function' then
|
||||||
log:info(MOD_ABBR, "reconfiguring component '" .. k .. "' (" .. v .. ")")
|
log:verbose(MOD_ABBR, "reconfiguring component '" .. k .. "' (" .. v .. ")")
|
||||||
reconf[fname](dirtyList)
|
reconf[fname](dirtyList)
|
||||||
else
|
else
|
||||||
log:warning(MOD_ABBR, "unknown component or action '" .. fname .. "' skipped")
|
log:warning(MOD_ABBR, "unknown component or action '" .. fname .. "' skipped")
|
||||||
@ -81,12 +81,12 @@ function M.switchConfiguration(components)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.commitComponent(c)
|
function M.commitComponent(c)
|
||||||
log:info(MOD_ABBR, "committing component '" .. c .. "'")
|
log:verbose(MOD_ABBR, "committing component '" .. c .. "'")
|
||||||
uci:commit(c)
|
uci:commit(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.reloadComponent(c, silent)
|
function M.reloadComponent(c, silent)
|
||||||
log:info(MOD_ABBR, "reloading component '" .. c .. "'")
|
log:verbose(MOD_ABBR, "reloading component '" .. c .. "'")
|
||||||
local command = 'reload'
|
local command = 'reload'
|
||||||
local cmd = '/etc/init.d/' .. c .. ' '..command
|
local cmd = '/etc/init.d/' .. c .. ' '..command
|
||||||
if silent ~= nil and silent then
|
if silent ~= nil and silent then
|
||||||
@ -94,7 +94,7 @@ function M.reloadComponent(c, silent)
|
|||||||
os.execute(cmd)
|
os.execute(cmd)
|
||||||
else
|
else
|
||||||
rv = utils.captureCommandOutput(cmd)
|
rv = utils.captureCommandOutput(cmd)
|
||||||
log:info(MOD_ABBR, " result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
log:verbose(MOD_ABBR, " result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ function M.disassociate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.getStatus()
|
function M.getStatus()
|
||||||
log:info(MOD_ABBR, "network:getStatus")
|
log:verbose(MOD_ABBR, "network:getStatus")
|
||||||
local file, error = io.open('/tmp/networkstatus.txt','r')
|
local file, error = io.open('/tmp/networkstatus.txt','r')
|
||||||
if file == nil then
|
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)
|
||||||
|
@ -107,7 +107,7 @@ function M.getStatus()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.setStatus(code,msg)
|
function M.setStatus(code,msg)
|
||||||
log:info(MOD_ABBR, "signin:setStatus: "..code.." | "..msg)
|
log:verbose(MOD_ABBR, "signin:setStatus: " .. code .. " (" .. msg .. ")")
|
||||||
status.set(STATUS_FILE,code,msg);
|
status.set(STATUS_FILE,code,msg);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -203,14 +203,13 @@ function M.remove_POST(request, response)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.signin(request, response)
|
function M.signin(request, response)
|
||||||
log:info(MOD_ABBR, "API:network/signin")
|
|
||||||
local success, output = signin.signin()
|
local success, output = signin.signin()
|
||||||
if success then
|
if success then
|
||||||
log:info(MOD_ABBR, " signed in")
|
log:info(MOD_ABBR, "signed in")
|
||||||
response:setSuccess("API:Network:signed in")
|
response:setSuccess("API:Network:signed in")
|
||||||
response:addData("response", output)
|
response:addData("response", output)
|
||||||
else
|
else
|
||||||
log:info(MOD_ABBR, "signing in failed")
|
log:warning(MOD_ABBR, "signing in failed")
|
||||||
response:setError("Signing in failed")
|
response:setError("Signing in failed")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user