From 97612c8a74455168c24c1f057ed7a8832779d38c Mon Sep 17 00:00:00 2001 From: Wouter R Date: Tue, 23 Feb 2016 13:47:17 +0100 Subject: [PATCH] Reduce logging on start of request handling: - change level of stasrtup message from info to verbose; - Combine two request information log messages into one. --- src/main.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.lua b/src/main.lua index 501b753..6836e1d 100644 --- a/src/main.lua +++ b/src/main.lua @@ -215,7 +215,7 @@ local function init(environment) 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 local n = tonumber(environment['CONTENT_LENGTH']) @@ -262,15 +262,16 @@ local function main(environment) log:warning(MOD_ABBR, "Signin failed: "..util.dump(msg)) end 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 - --log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "") - -- .. "/" .. (rq:getRealApiFunctionName() or "") .. " with arguments: " .. util.dump(rq:getAll())) - log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "") - .. "/" .. (rq:getRealApiFunctionName() or "")) + -- Note: the commented log message will print too many data if it's for instance dumping a gcode add request + --logMessage = "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "") + -- .. "/" .. (rq:getRealApiFunctionName() or "") .. " with arguments: " .. util.dump(rq:getAll()) + logMessage = rq:getRequestMethod() .. " request for " .. (rq:getRequestedApiModule() or "") + .. "/" .. (rq:getRealApiFunctionName() or "") if rq:getRequestMethod() ~= 'CMDLINE' then - log:info(MOD_ABBR, "remote IP/port: " .. rq:getRemoteHost() .. "/" .. rq:getRemotePort()) - --log:verbose(MOD_ABBR, "user agent: " .. rq:getUserAgent()) + logMessage = logMessage .. " (remote IP/port: " .. rq:getRemoteHost() .. "/" .. rq:getRemotePort() .. ")" + --logMessage = logMessage .. " (user agent: " .. rq:getUserAgent() .. ")" end + log:info(MOD_ABBR, logMessage) local response, err = rq:handle()