0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-05 06:03:23 +01:00

Reduce logging on start of request handling:

- change level of stasrtup message from info to verbose;
- Combine two request information log messages into one.
This commit is contained in:
Wouter R 2016-02-23 13:47:17 +01:00
parent 03e34f2676
commit 97612c8a74

View File

@ -215,7 +215,7 @@ local function init(environment)
end end
if dbgText ~= "" then dbgText = " (" .. dbgText .. " debugging)" end if dbgText ~= "" then dbgText = " (" .. dbgText .. " debugging)" end
log:info(MOD_ABBR, "=======rest api" .. dbgText .. "=======") log:verbose(MOD_ABBR, "=======rest api" .. dbgText .. "=======")
if (environment['REQUEST_METHOD'] == 'POST') then if (environment['REQUEST_METHOD'] == 'POST') then
local n = tonumber(environment['CONTENT_LENGTH']) local n = tonumber(environment['CONTENT_LENGTH'])
@ -262,15 +262,16 @@ local function main(environment)
log:warning(MOD_ABBR, "Signin failed: "..util.dump(msg)) log:warning(MOD_ABBR, "Signin failed: "..util.dump(msg))
end end
elseif rq:getRequestMethod() ~= 'CMDLINE' or confDefaults.DEBUG_API then elseif rq:getRequestMethod() ~= 'CMDLINE' or confDefaults.DEBUG_API then
-- Note: the commented log statement will print too many data if it's for instance dumping a gcode add request -- Note: the commented log message will print too many data if it's for instance dumping a gcode add request
--log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>") --logMessage = "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
-- .. "/" .. (rq:getRealApiFunctionName() or "<unknown>") .. " with arguments: " .. util.dump(rq:getAll())) -- .. "/" .. (rq:getRealApiFunctionName() or "<unknown>") .. " with arguments: " .. util.dump(rq:getAll())
log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>") logMessage = rq:getRequestMethod() .. " request for " .. (rq:getRequestedApiModule() or "<unknown>")
.. "/" .. (rq:getRealApiFunctionName() or "<unknown>")) .. "/" .. (rq:getRealApiFunctionName() or "<unknown>")
if rq:getRequestMethod() ~= 'CMDLINE' then if rq:getRequestMethod() ~= 'CMDLINE' then
log:info(MOD_ABBR, "remote IP/port: " .. rq:getRemoteHost() .. "/" .. rq:getRemotePort()) logMessage = logMessage .. " (remote IP/port: " .. rq:getRemoteHost() .. "/" .. rq:getRemotePort() .. ")"
--log:verbose(MOD_ABBR, "user agent: " .. rq:getUserAgent()) --logMessage = logMessage .. " (user agent: " .. rq:getUserAgent() .. ")"
end end
log:info(MOD_ABBR, logMessage)
local response, err = rq:handle() local response, err = rq:handle()