From 52c94355345d5ce0c1f05415c823ec9c44f9062e Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 4 Jun 2014 23:19:59 +0200 Subject: [PATCH] Fixups after cherry-picking commits from unify-logging+chunk-checking branch: - add missing log module arguments, - remove temporary log level mapping. --- src/main.lua | 9 ++------- src/network/wlanconfig.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main.lua b/src/main.lua index 368b284..c4b38bc 100644 --- a/src/main.lua +++ b/src/main.lua @@ -77,9 +77,9 @@ local function setupAutoWifiMode() -- signin to connect.doodle3d.com local success, output = Signin.signin() if success then - log:info("Signed in") + log:info(MOD_ABBR, "Signed in") else - log:info("Signing in failed") + log:info(MOD_ABBR, "Signing in failed") end -- report we are connected after signin attempt netconf.setStatus(netconf.CONNECTED,"Connected"); @@ -131,11 +131,6 @@ local function setupLogger() local logTargetSetting = settings.getSystemKey('logfile') local logLevelSetting = settings.get('system.log.level') local logTargetError, logLevelError = nil, nil - - -- TEMP: for now, translate print3d log level to firmware level, these will be unfiied in the future - -- we get (print3d): quiet,error,warning,info,verbose,bulk -- and we need (firmware): debug,info,warn,error,fatal - logLevelMapping = { quiet='fatal', error='error', warning='warn', info='warn', verbose='info', bulk='debug' } - logLevelSetting = logLevelMapping[logLevelSetting] if type(logTargetSetting) == 'string' then local specialTarget = logTargetSetting:match('^<(.*)>$') diff --git a/src/network/wlanconfig.lua b/src/network/wlanconfig.lua index 39f7fd3..5f626c4 100644 --- a/src/network/wlanconfig.lua +++ b/src/network/wlanconfig.lua @@ -27,12 +27,12 @@ local deviceName, deviceApi local cachedApSsid, baseApSsid = nil, nil function M.getSubstitutedSsid(unformattedSsid) - log:debug("getSubstitutedSsid unformattedSsid:'" .. (unformattedSsid or "nil") .. "' baseApSsid:'" .. (baseApSsid or "nil") .. "' cachedApSsid:'" .. (cachedApSsid or "nil")) + log:debug(MOD_ABBR, "getSubstitutedSsid unformattedSsid:'" .. (unformattedSsid or "nil") .. "' baseApSsid:'" .. (baseApSsid or "nil") .. "' cachedApSsid:'" .. (cachedApSsid or "nil")) if unformattedSsid == baseApSsid and cachedApSsid ~= nil then return cachedApSsid end if not unformattedSsid or type(unformattedSsid) ~= 'string' then return nil end local macTail = M.getMacAddress():sub(7) - log:debug(" macTail:'" .. macTail) + log:debug(MOD_ABBR, " macTail:'" .. macTail) baseApSsid = unformattedSsid cachedApSsid = unformattedSsid:gsub('%%%%MAC_ADDR_TAIL%%%%', macTail) return cachedApSsid @@ -109,9 +109,9 @@ end --returns the wireless device's MAC address (as string, without colons) --(lua numbers on openWrt seem to be 32bit so they cannot represent a MAC address as one number) function M.getMacAddress() - log:debug("getMacAddress") + log:debug(MOD_ABBR, "getMacAddress") local macText = utils.readFile('/sys/class/net/' .. deviceName .. '/address') - log:debug(" macText: '" .. (macText or "nil") .. "'") + log:debug(MOD_ABBR, " macText: '" .. (macText or "nil") .. "'") local out = '' -- Hack to prevent failure in case the MAC address could not be obtained. @@ -143,9 +143,9 @@ end -- @return data for all or requested network; false+error on failure or nil when requested network not found function M.getScanInfo(ssid) local iw = iwinfo[deviceApi] - log:info("start wifi scan") + log:info(MOD_ABBR, "start wifi scan") local sr = iw.scanlist(deviceName) - log:info("wifi scan done") + log:info(MOD_ABBR, "wifi scan done") local si, se if ssid == nil then