mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
cleanup: expand tab to 4 spaces
This commit is contained in:
@@ -1,45 +1,45 @@
|
||||
local DocSettings = require("docsettings") -- for dump method
|
||||
|
||||
local Dbg = {
|
||||
is_on = false,
|
||||
ev_log = nil,
|
||||
is_on = false,
|
||||
ev_log = nil,
|
||||
}
|
||||
|
||||
local Dbg_mt = {}
|
||||
|
||||
local function LvDEBUG(lv, ...)
|
||||
local line = ""
|
||||
for i,v in ipairs({...}) do
|
||||
if type(v) == "table" then
|
||||
line = line .. " " .. DocSettings:dump(v, lv)
|
||||
else
|
||||
line = line .. " " .. tostring(v)
|
||||
end
|
||||
end
|
||||
print("#"..line)
|
||||
local line = ""
|
||||
for i,v in ipairs({...}) do
|
||||
if type(v) == "table" then
|
||||
line = line .. " " .. DocSettings:dump(v, lv)
|
||||
else
|
||||
line = line .. " " .. tostring(v)
|
||||
end
|
||||
end
|
||||
print("#"..line)
|
||||
end
|
||||
|
||||
function Dbg_mt.__call(dbg, ...)
|
||||
if dbg.is_on then LvDEBUG(math.huge, ...) end
|
||||
if dbg.is_on then LvDEBUG(math.huge, ...) end
|
||||
end
|
||||
|
||||
function Dbg:turnOn()
|
||||
self.is_on = true
|
||||
self.is_on = true
|
||||
|
||||
-- create or clear ev log file
|
||||
os.execute("echo > ev.log")
|
||||
self.ev_log = io.open("ev.log", "w")
|
||||
-- create or clear ev log file
|
||||
os.execute("echo > ev.log")
|
||||
self.ev_log = io.open("ev.log", "w")
|
||||
end
|
||||
|
||||
function Dbg:logEv(ev)
|
||||
local log = ev.type.."|"..ev.code.."|"
|
||||
..ev.value.."|"..ev.time.sec.."|"..ev.time.usec.."\n"
|
||||
self.ev_log:write(log)
|
||||
self.ev_log:flush()
|
||||
local log = ev.type.."|"..ev.code.."|"
|
||||
..ev.value.."|"..ev.time.sec.."|"..ev.time.usec.."\n"
|
||||
self.ev_log:write(log)
|
||||
self.ev_log:flush()
|
||||
end
|
||||
|
||||
function Dbg:traceback()
|
||||
LvDEBUG(math.huge, debug.traceback())
|
||||
LvDEBUG(math.huge, debug.traceback())
|
||||
end
|
||||
|
||||
setmetatable(Dbg, Dbg_mt)
|
||||
|
||||
Reference in New Issue
Block a user