0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 11:03:48 +01:00

Fixups after cherry-picking commits from unify-logging+chunk-checking branch:

- add missing log module arguments,
- remove temporary log level mapping.
This commit is contained in:
Wouter R 2014-06-04 23:19:59 +02:00
parent bca5228b73
commit 52c9435534
2 changed files with 8 additions and 13 deletions

View File

@ -77,9 +77,9 @@ local function setupAutoWifiMode()
-- signin to connect.doodle3d.com -- signin to connect.doodle3d.com
local success, output = Signin.signin() local success, output = Signin.signin()
if success then if success then
log:info("Signed in") log:info(MOD_ABBR, "Signed in")
else else
log:info("Signing in failed") log:info(MOD_ABBR, "Signing in failed")
end end
-- report we are connected after signin attempt -- report we are connected after signin attempt
netconf.setStatus(netconf.CONNECTED,"Connected"); netconf.setStatus(netconf.CONNECTED,"Connected");
@ -131,11 +131,6 @@ local function setupLogger()
local logTargetSetting = settings.getSystemKey('logfile') local logTargetSetting = settings.getSystemKey('logfile')
local logLevelSetting = settings.get('system.log.level') local logLevelSetting = settings.get('system.log.level')
local logTargetError, logLevelError = nil, nil 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 if type(logTargetSetting) == 'string' then
local specialTarget = logTargetSetting:match('^<(.*)>$') local specialTarget = logTargetSetting:match('^<(.*)>$')

View File

@ -27,12 +27,12 @@ local deviceName, deviceApi
local cachedApSsid, baseApSsid = nil, nil local cachedApSsid, baseApSsid = nil, nil
function M.getSubstitutedSsid(unformattedSsid) 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 unformattedSsid == baseApSsid and cachedApSsid ~= nil then return cachedApSsid end
if not unformattedSsid or type(unformattedSsid) ~= 'string' then return nil end if not unformattedSsid or type(unformattedSsid) ~= 'string' then return nil end
local macTail = M.getMacAddress():sub(7) local macTail = M.getMacAddress():sub(7)
log:debug(" macTail:'" .. macTail) log:debug(MOD_ABBR, " macTail:'" .. macTail)
baseApSsid = unformattedSsid baseApSsid = unformattedSsid
cachedApSsid = unformattedSsid:gsub('%%%%MAC_ADDR_TAIL%%%%', macTail) cachedApSsid = unformattedSsid:gsub('%%%%MAC_ADDR_TAIL%%%%', macTail)
return cachedApSsid return cachedApSsid
@ -109,9 +109,9 @@ end
--returns the wireless device's MAC address (as string, without colons) --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) --(lua numbers on openWrt seem to be 32bit so they cannot represent a MAC address as one number)
function M.getMacAddress() function M.getMacAddress()
log:debug("getMacAddress") log:debug(MOD_ABBR, "getMacAddress")
local macText = utils.readFile('/sys/class/net/' .. deviceName .. '/address') 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 = '' local out = ''
-- Hack to prevent failure in case the MAC address could not be obtained. -- 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 -- @return data for all or requested network; false+error on failure or nil when requested network not found
function M.getScanInfo(ssid) function M.getScanInfo(ssid)
local iw = iwinfo[deviceApi] local iw = iwinfo[deviceApi]
log:info("start wifi scan") log:info(MOD_ABBR, "start wifi scan")
local sr = iw.scanlist(deviceName) local sr = iw.scanlist(deviceName)
log:info("wifi scan done") log:info(MOD_ABBR, "wifi scan done")
local si, se local si, se
if ssid == nil then if ssid == nil then