mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 02:53:49 +01:00
Reorder and rename log levels to match those in print server.
Fix typo in regex in getLocalIp function. Conflicts: src/script/wifibox.uci.config
This commit is contained in:
parent
3a3abb9c55
commit
2459cda0ac
10
src/main.lua
10
src/main.lua
@ -125,7 +125,7 @@ end
|
||||
-- @treturn bool True on success, false on error.
|
||||
local function setupLogger()
|
||||
local logStream = io.stderr -- use stderr as hard-coded default target
|
||||
local logLevel = log.LEVEL.debug -- use debug logging as hard-coded default level
|
||||
local logLevel = log.LEVEL.verbose -- use verbose logging as hard-coded default level
|
||||
|
||||
local logTargetSetting = settings.getSystemKey('logfile')
|
||||
local logLevelSetting = settings.get('system.log.level')
|
||||
@ -178,7 +178,7 @@ local function setupLogger()
|
||||
end
|
||||
|
||||
if logLevelError then
|
||||
log:error("uci config specifies invalid log level '" .. logLevelSetting .. "', using debug level as fallback")
|
||||
log:error("uci config specifies invalid log level '" .. logLevelSetting .. "', using verbose level as fallback")
|
||||
rv = false
|
||||
end
|
||||
|
||||
@ -222,10 +222,10 @@ local function main(environment)
|
||||
local rq = RequestClass.new(environment, postData, confDefaults.DEBUG_API)
|
||||
|
||||
if rq:getRequestMethod() == 'CMDLINE' and rq:get('autowifi') ~= nil then
|
||||
|
||||
|
||||
local version = updater.formatVersion(updater.getCurrentVersion());
|
||||
log:info("Doodle3D version: "..util.dump(version))
|
||||
|
||||
|
||||
log:info("running in autowifi mode")
|
||||
local rv,msg = setupAutoWifiMode()
|
||||
|
||||
@ -255,7 +255,7 @@ local function main(environment)
|
||||
.. "/" .. (rq:getRealApiFunctionName() or "<unknown>"))
|
||||
if rq:getRequestMethod() ~= 'CMDLINE' then
|
||||
log:info("remote IP/port: " .. rq:getRemoteHost() .. "/" .. rq:getRemotePort())
|
||||
--log:debug("user agent: " .. rq:getUserAgent())
|
||||
--log:verbose("user agent: " .. rq:getUserAgent())
|
||||
end
|
||||
|
||||
local response, err = rq:handle()
|
||||
|
@ -25,9 +25,9 @@ M.WWW_RENAME_NAME = '/www-regular'
|
||||
M.CONNECTING_FAILED = -1
|
||||
M.NOT_CONNECTED = 0
|
||||
M.CONNECTING = 1
|
||||
M.CONNECTED = 2
|
||||
M.CREATING = 3
|
||||
M.CREATED = 4
|
||||
M.CONNECTED = 2
|
||||
M.CREATING = 3
|
||||
M.CREATED = 4
|
||||
|
||||
local function reloadBit(dlist, itemname)
|
||||
if dlist[itemname] == nil then dlist[itemname] = '' end
|
||||
@ -62,10 +62,10 @@ function M.switchConfiguration(components)
|
||||
for k,v in pairs(components) do
|
||||
local fname = k .. '_' .. v
|
||||
if type(reconf[fname]) == 'function' then
|
||||
log:debug("reconfiguring component '" .. k .. "' (" .. v .. ")")
|
||||
log:verbose("reconfiguring component '" .. k .. "' (" .. v .. ")")
|
||||
reconf[fname](dirtyList)
|
||||
else
|
||||
log:warn("unknown component or action '" .. fname .. "' skipped")
|
||||
log:warning("unknown component or action '" .. fname .. "' skipped")
|
||||
end
|
||||
end
|
||||
|
||||
@ -84,15 +84,15 @@ function M.commitComponent(c)
|
||||
end
|
||||
|
||||
function M.reloadComponent(c, silent)
|
||||
log:info("reloading component '" .. c .. "'")
|
||||
log:info("reloading component '" .. c .. "'")
|
||||
local command = 'reload'
|
||||
local cmd = '/etc/init.d/' .. c .. ' '..command
|
||||
if silent ~= nil and silent then
|
||||
if silent ~= nil and silent then
|
||||
cmd = cmd .. ' &> /dev/null'
|
||||
os.execute(cmd)
|
||||
else
|
||||
rv = utils.captureCommandOutput(cmd)
|
||||
log:debug(" result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
||||
log:verbose(" result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
||||
end
|
||||
end
|
||||
|
||||
@ -213,7 +213,7 @@ function reconf.dnsredir_add(dirtyList)
|
||||
local redirText = '/#/' .. settings.get('network.ap.address')
|
||||
local sname = utils.getUciSectionName('dhcp', 'dnsmasq')
|
||||
if sname == nil then return log:error("dhcp config does not contain a dnsmasq section") end
|
||||
if uci:get('dhcp', sname, 'address') ~= nil then return log:debug("DNS address redirection already in place, not re-adding", false) end
|
||||
if uci:get('dhcp', sname, 'address') ~= nil then return log:verbose("DNS address redirection already in place, not re-adding", false) end
|
||||
|
||||
uci:set('dhcp', sname, 'address', {redirText})
|
||||
commitBit(dirtyList, 'dhcp'); reloadBit(dirtyList, 'dnsmasq')
|
||||
@ -230,7 +230,7 @@ end
|
||||
--TODO: handle os.rename() return values (nil+msg on error)
|
||||
function reconf.wwwcaptive_add(dirtyList)
|
||||
if utils.exists(M.WWW_CAPTIVE_INDICATOR) then
|
||||
return log:debug("WWW captive directory already in place, not redoing", false)
|
||||
return log:verbose("WWW captive directory already in place, not redoing", false)
|
||||
end
|
||||
local rv,reason = os.rename('/www', M.WWW_RENAME_NAME)
|
||||
if rv == true then
|
||||
@ -241,7 +241,7 @@ function reconf.wwwcaptive_add(dirtyList)
|
||||
end
|
||||
end
|
||||
function reconf.wwwcaptive_rm(dirtyList)
|
||||
if not utils.exists(M.WWW_CAPTIVE_INDICATOR) then return log:debug("WWW captive directory not in place, not undoing", false) end
|
||||
if not utils.exists(M.WWW_CAPTIVE_INDICATOR) then return log:verbose("WWW captive directory not in place, not undoing", false) end
|
||||
os.remove('/www')
|
||||
if os.rename(M.WWW_RENAME_NAME, '/www') ~= true then
|
||||
return log:error("Could not rename " .. M.WWW_RENAME_NAME .. " to /www")
|
||||
@ -275,16 +275,16 @@ end
|
||||
-- @return True on success or nil+msg on error.
|
||||
function M.setupAccessPoint(ssid)
|
||||
M.setStatus(M.CREATING,"Creating access point '"..ssid.."'...");
|
||||
|
||||
-- add access point configuration
|
||||
|
||||
-- add access point configuration
|
||||
M.switchConfiguration({apnet="add_noreload"})
|
||||
wifi.activateConfig(ssid)
|
||||
-- NOTE: dnsmasq must be reloaded after network or it will be unable to serve IP addresses
|
||||
M.switchConfiguration({ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" })
|
||||
M.switchConfiguration({dhcp="reload"})
|
||||
|
||||
|
||||
M.setStatus(M.CREATED,"Access point created");
|
||||
|
||||
|
||||
local ds = wifi.getDeviceState()
|
||||
--log:info(" network/status: ")
|
||||
log:info(" ssid: ".. utils.dump(ds.ssid))
|
||||
@ -298,10 +298,10 @@ function M.setupAccessPoint(ssid)
|
||||
log:info(" signal: ".. utils.dump(ds.signal))
|
||||
log:info(" noise: ".. utils.dump(ds.noise))
|
||||
log:info(" raw: ".. utils.dump(ds))
|
||||
|
||||
|
||||
local localip = wifi.getLocalIP()
|
||||
log:info(" localip: "..utils.dump(localip))]]--
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -311,14 +311,14 @@ end
|
||||
-- @tparam string ssid The SSID to use for the access point.
|
||||
-- @return True on success or nil+msg on error.
|
||||
function M.enableAccessPoint(ssid)
|
||||
log:debug("enableAccessPoint ssid: ".. utils.dump(ssid))
|
||||
|
||||
log:verbose("enableAccessPoint ssid: ".. utils.dump(ssid))
|
||||
|
||||
M.switchConfiguration{apnet="add_noreload"}
|
||||
wifi.activateConfig(ssid)
|
||||
|
||||
|
||||
local ds = wifi.getDeviceState()
|
||||
log:debug(" ssid: ".. utils.dump(ds.ssid))
|
||||
|
||||
log:verbose(" ssid: ".. utils.dump(ds.ssid))
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -332,7 +332,7 @@ end
|
||||
function M.associateSsid(ssid, passphrase, recreate)
|
||||
log:info("netconfig:associateSsid: "..(ssid or "<nil>")..", "..(recreate or "<nil>"))
|
||||
M.setStatus(M.CONNECTING,"Connecting...");
|
||||
|
||||
|
||||
-- see if previously configured network for given ssid exists
|
||||
local cfg = nil
|
||||
for _, net in ipairs(wifi.getConfigs()) do
|
||||
@ -341,7 +341,7 @@ function M.associateSsid(ssid, passphrase, recreate)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- if not, or if newly created configuration is requested, create a new configuration
|
||||
if cfg == nil or recreate ~= nil then
|
||||
local scanResult, msg = wifi.getScanInfo(ssid)
|
||||
@ -365,16 +365,16 @@ function M.associateSsid(ssid, passphrase, recreate)
|
||||
--M.switchConfiguration{ wifiiface="add", apnet="rm", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wireless="reload" }
|
||||
--M.switchConfiguration{ wifiiface="add", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wireless="reload" }
|
||||
M.switchConfiguration({ wifiiface="add", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm" })
|
||||
|
||||
|
||||
-- we check if we get a ssid and ip in max 5 seconds
|
||||
-- if not there is probably a issue
|
||||
-- if not there is probably a issue
|
||||
local attemptInterval = 1
|
||||
local maxAttempts = 5
|
||||
local attempt = 0
|
||||
local nextAttemptTime = os.time()
|
||||
while true do
|
||||
if os.time() > nextAttemptTime then
|
||||
log:debug("associated check "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||
log:verbose("associated check "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||
if wifi.getLocalIP() ~= nil and wifi.getDeviceState().ssid == ssid then
|
||||
break
|
||||
else
|
||||
@ -390,18 +390,18 @@ function M.associateSsid(ssid, passphrase, recreate)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- signin to connect.doodle3d.com
|
||||
local success, output = signin.signin()
|
||||
if success then
|
||||
log:info("Signed in")
|
||||
else
|
||||
else
|
||||
log:info("Signing in failed")
|
||||
end
|
||||
|
||||
|
||||
-- report we are connected after signin attempt
|
||||
M.setStatus(M.CONNECTED,"Connected");
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
--- Disassociate wlan device as client from all SSID's.
|
||||
@ -411,7 +411,7 @@ end
|
||||
function M.disassociate()
|
||||
|
||||
M.setStatus(M.NOT_CONNECTED,"Not connected");
|
||||
|
||||
|
||||
wifi.activateConfig()
|
||||
return wifi.restart()
|
||||
end
|
||||
|
@ -28,54 +28,54 @@ local SIGNING_IN_STATUS = 2
|
||||
--
|
||||
function M.signin()
|
||||
|
||||
--log:debug("signin:signin");
|
||||
--log:verbose("signin:signin");
|
||||
|
||||
local code, msg = M.getStatus()
|
||||
--log:debug(" status: "..utils.dump(code).." "..utils.dump(msg));
|
||||
--log:verbose(" status: "..utils.dump(code).." "..utils.dump(msg));
|
||||
|
||||
-- if we are already signin in, skip
|
||||
if(code == SIGNING_IN_STATUS) then
|
||||
log:debug(" skipping signin")
|
||||
log:verbose(" skipping signin")
|
||||
return
|
||||
end
|
||||
|
||||
M.setStatus(SIGNING_IN_STATUS,"signing in")
|
||||
|
||||
local baseurl = "http://connect.doodle3d.com/api/signin.php"
|
||||
|
||||
|
||||
local attemptInterval = 1
|
||||
local maxAttempts = 20
|
||||
local attempt = 0
|
||||
|
||||
|
||||
local nextAttemptTime = os.time()
|
||||
|
||||
|
||||
local localip = ""
|
||||
local signinResponse = ""
|
||||
while true do
|
||||
if os.time() > nextAttemptTime then
|
||||
log:debug("signin attempt "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||
log:verbose("signin attempt "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||
local signedin = false
|
||||
local localip = wifi.getLocalIP();
|
||||
--log:debug(" localip: "..utils.dump(localip))
|
||||
--log:verbose(" localip: "..utils.dump(localip))
|
||||
if localip ~= nil then
|
||||
|
||||
|
||||
local wifiboxid = wifi.getSubstitutedSsid(settings.get('network.cl.wifiboxid'))
|
||||
wifiboxid = urlcode.escape(wifiboxid)
|
||||
|
||||
|
||||
local cmd = "wget -q -T 2 -t 1 -O - "..baseurl.."?wifiboxid="..wifiboxid.."\\&localip="..localip;
|
||||
signinResponse = utils.captureCommandOutput(cmd);
|
||||
log:debug(" signin response: \n"..utils.dump(signinResponse))
|
||||
log:verbose(" signin response: \n"..utils.dump(signinResponse))
|
||||
local success = signinResponse:match('"status":"success"')
|
||||
log:debug(" success: "..utils.dump(success))
|
||||
log:verbose(" success: "..utils.dump(success))
|
||||
if success ~= nil then
|
||||
signedin = true
|
||||
else
|
||||
log:warn("signin failed request failed (response: "..utils.dump(signinResponse)..")")
|
||||
log:warning("signin failed request failed (response: "..utils.dump(signinResponse)..")")
|
||||
end
|
||||
else
|
||||
log:warn("signin failed no local ip found (attempt: "..utils.dump(attempt).."/"..utils.dump(maxAttempts)..")")
|
||||
else
|
||||
log:warning("signin failed no local ip found (attempt: "..utils.dump(attempt).."/"..utils.dump(maxAttempts)..")")
|
||||
end
|
||||
|
||||
|
||||
if signedin then
|
||||
break
|
||||
else
|
||||
@ -90,7 +90,7 @@ function M.signin()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
M.setStatus(IDLE_STATUS,"idle")
|
||||
return string.len(signinResponse) > 0, signinResponse
|
||||
end
|
||||
|
@ -126,9 +126,10 @@ end
|
||||
--returns the wireless local ip address
|
||||
function M.getLocalIP()
|
||||
local ifconfig, rv = utils.captureCommandOutput("ifconfig wlan0");
|
||||
--log:debug(" ifconfig: \n"..utils.dump(ifconfig));
|
||||
local localip = ifconfig:match('inet addr:([%d\.]+)')
|
||||
return localip;
|
||||
--log:verbose(" ifconfig: \n"..utils.dump(ifconfig));
|
||||
|
||||
local localip = ifconfig:match('inet addr:([%d%.]+)')
|
||||
return localip
|
||||
end
|
||||
|
||||
function M.getDeviceName()
|
||||
@ -241,7 +242,7 @@ function M.createConfigFromScanInfo(info, passphrase, disabled)
|
||||
uci:foreach('wireless', 'wifi-iface', function(s)
|
||||
--if s.bssid == info.bssid then
|
||||
if s.ssid == info.ssid then
|
||||
log:debug("removing old wireless config for net '" .. s.ssid .. "'")
|
||||
log:verbose("removing old wireless config for net '" .. s.ssid .. "'")
|
||||
uci:delete('wireless', s['.name'])
|
||||
-- return false --keep looking, just in case multiple entries with this bssid exist
|
||||
end
|
||||
|
@ -194,7 +194,7 @@ function M.print_POST(request, response)
|
||||
end
|
||||
|
||||
if argIsFirst == true then
|
||||
log:debug("clearing all gcode for " .. printer:getId())
|
||||
log:verbose("clearing all gcode for " .. printer:getId())
|
||||
response:addData('gcode_clear',true)
|
||||
local rv,msg = printer:clearGcode()
|
||||
|
||||
|
@ -133,7 +133,7 @@ function M._global_POST(request, response)
|
||||
local sketchIdx = listSize > 0 and sketches[listSize] + 1 or 1
|
||||
local sketchFile = M.SKETCH_DIR .. '/' .. constructSketchFilename(sketchIdx)
|
||||
|
||||
log:debug("saving sketch #" .. sketchIdx .. " (" .. argData:len() .. " bytes)")
|
||||
log:verbose("saving sketch #" .. sketchIdx .. " (" .. argData:len() .. " bytes)")
|
||||
local saveFile,msg = io.open(sketchFile, 'w')
|
||||
|
||||
if not saveFile then
|
||||
|
@ -167,7 +167,8 @@ setmetatable(M, {
|
||||
})
|
||||
|
||||
--This function initializes itself using various environment variables, the arg array and the given postData
|
||||
--NOTE: if debugging is enabled, commandline arguments 'm' and 'f' override requested module and function
|
||||
--NOTE: if debugging is enabled, commandline argument 'p' (path) overrides requested module and function and
|
||||
-- 'r' (rqType) overrides request method
|
||||
function M.new(environment, postData, debugEnabled)
|
||||
local self = setmetatable({}, M)
|
||||
|
||||
|
@ -15,7 +15,7 @@ local settings = require('util.settings')
|
||||
local defaults = require('conf_defaults')
|
||||
local utils = require('util.utils')
|
||||
local log = require('util.logger')
|
||||
|
||||
|
||||
local M = {}
|
||||
M.__index = M
|
||||
|
||||
@ -167,10 +167,10 @@ function M:send()
|
||||
io.write("\r\n")
|
||||
io.write(self.binaryData)
|
||||
end
|
||||
|
||||
if self.body.status ~= "success" then
|
||||
log:debug("Response:"..utils.dump(self.body.status).." ("..utils.dump(self.body.msg)..")")
|
||||
end
|
||||
|
||||
if self.body.status ~= "success" then
|
||||
log:verbose("Response:"..utils.dump(self.body.status).." ("..utils.dump(self.body.msg)..")")
|
||||
end
|
||||
end
|
||||
|
||||
--- Sets the response object to return binary data instead of JSON as its body.
|
||||
|
@ -82,7 +82,7 @@ local baseUrl = M.DEFAULT_BASE_URL -- default, can be overwritten by M.setBaseUr
|
||||
-- @string msg The message to log.
|
||||
local function P(lvl, msg)
|
||||
if log then
|
||||
if lvl == -1 then log:debug(msg)
|
||||
if lvl == -1 then log:verbose(msg)
|
||||
elseif lvl == 0 or lvl == 1 then log:info(msg)
|
||||
end
|
||||
else
|
||||
@ -90,7 +90,7 @@ local function P(lvl, msg)
|
||||
end
|
||||
end
|
||||
|
||||
--- Log a debug message, this function wraps @{P}.
|
||||
--- Log a debug/verbose message, this function wraps @{P}.
|
||||
-- The message will be logged with level -1 and be prefixed with '(DBG)'.
|
||||
-- @string msg The message to log.
|
||||
local function D(msg) P(-1, (log and msg or "(DBG) " .. msg)) end
|
||||
|
@ -13,30 +13,31 @@ local utils = require('util.utils')
|
||||
|
||||
local M = {}
|
||||
|
||||
local logLevel, logVerbose, logStream
|
||||
local logLevel, logVerboseFmt, logStream
|
||||
|
||||
--- Available log levels
|
||||
--- Available log levels (starting at 1)
|
||||
-- @table LEVEL
|
||||
M.LEVEL = {
|
||||
'debug', -- for debug messages
|
||||
'info', -- for informational messages
|
||||
'warn', -- for warnings (something is wrong/fishy but not neccesarily problematic)
|
||||
'error', -- for recoverable errors
|
||||
'fatal' -- for unrecoverable errors
|
||||
'quiet', -- not used for logging, only for setting levels
|
||||
'error', -- fatal or non-fatal error condition
|
||||
'warning', -- possibly troublesome situation
|
||||
'info', -- information about what the application is doing
|
||||
'verbose', -- extra trail information on what the application is doing
|
||||
'bulk' -- debug information (in large amounts)
|
||||
}
|
||||
|
||||
-- M.LEVEL already has idx=>name entries, now create name=>idx entries
|
||||
-- M.LEVEL already has idx=>name entries, now create name=>idx entries so it can be indexed both ways
|
||||
for i,v in ipairs(M.LEVEL) do
|
||||
M.LEVEL[v] = i
|
||||
end
|
||||
|
||||
|
||||
local function log(level, msg, verbose)
|
||||
if level >= logLevel then
|
||||
local function log(level, msg, verboseFmt)
|
||||
if level <= logLevel then
|
||||
local now = os.date('%m-%d %H:%M:%S')
|
||||
local i = debug.getinfo(3) --the stack frame just above the logger call
|
||||
local v = verbose
|
||||
if v == nil then v = logVerbose end
|
||||
local v = verboseFmt
|
||||
if v == nil then v = logVerboseFmt end
|
||||
local name = i.name or "(nil)"
|
||||
local vVal = 'nil'
|
||||
local m = (type(msg) == 'string') and msg or utils.dump(msg)
|
||||
@ -52,21 +53,30 @@ end
|
||||
--- Initializes the logger.
|
||||
-- @tparam @{util.logger.LEVEL} level Minimum level of messages to log.
|
||||
-- @tparam bool verbose Write verbose log messages (include file/line inforomation).
|
||||
function M:init(level, verbose)
|
||||
logLevel = level or M.LEVEL.warn
|
||||
logVerbose = verbose or false
|
||||
function M:init(level, verboseFmt)
|
||||
logLevel = level or M.LEVEL.warning
|
||||
logVerboseFmt = verboseFmt or false
|
||||
logStream = stream or io.stdout
|
||||
end
|
||||
|
||||
function M:setLevel(level, verboseFmt)
|
||||
logLevel = level or M.LEVEL.warning
|
||||
logVerboseFmt = verboseFmt or false
|
||||
end
|
||||
|
||||
-- pass nil as stream to reset to stdout
|
||||
function M:setStream(stream)
|
||||
logStream = stream or io.stdout
|
||||
end
|
||||
|
||||
function M:debug(msg, verbose) log(M.LEVEL.debug, msg, verbose); return true end
|
||||
function M:info(msg, verbose) log(M.LEVEL.info, msg, verbose); return true end
|
||||
function M:warn(msg, verbose) log(M.LEVEL.warn, msg, verbose); return true end
|
||||
function M:error(msg, verbose) log(M.LEVEL.error, msg, verbose); return false end
|
||||
function M:fatal(msg, verbose) log(M.LEVEL.fatal, msg, verbose); return false end
|
||||
function M:getLevel()
|
||||
return logLevel, logVerboseFmt
|
||||
end
|
||||
|
||||
function M:error(msg, verboseFmt) log(M.LEVEL.error, msg, verboseFmt); return false end
|
||||
function M:warning(msg, verboseFmt) log(M.LEVEL.warning, msg, verboseFmt); return true end
|
||||
function M:info(msg, verboseFmt) log(M.LEVEL.info, msg, verboseFmt); return true end
|
||||
function M:verbose(msg, verboseFmt) log(M.LEVEL.verbose, msg, verboseFmt); return true end
|
||||
function M:bulk(msg, verboseFmt) log(M.LEVEL.bulk, msg, verboseFmt); return true end
|
||||
|
||||
return M
|
||||
|
@ -81,7 +81,7 @@ end
|
||||
--returns a printer instance or nil (and sets error state on response in the latter case)
|
||||
function M.createPrinterOrFail(deviceId, response)
|
||||
|
||||
--log:debug("API:printer:createPrinterOrFail: "..utils.dump(deviceId))
|
||||
--log:verbose("API:printer:createPrinterOrFail: "..utils.dump(deviceId))
|
||||
local msg,printer = nil, nil
|
||||
|
||||
if deviceId == nil or deviceId == "" then
|
||||
@ -98,6 +98,8 @@ function M.createPrinterOrFail(deviceId, response)
|
||||
return nil
|
||||
end
|
||||
|
||||
printer:setLocalLogLevel(log:getLevel())
|
||||
|
||||
return printer
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user