From 4540d51a6e94207d73dbb3ac31ced6acf3aef5d8 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Tue, 25 Oct 2016 00:08:47 -0700 Subject: [PATCH] settings: add entry to toggle debug mode --- frontend/dbg.lua | 1 + reader.lua | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/dbg.lua b/frontend/dbg.lua index 4d8f4cd36..961537250 100644 --- a/frontend/dbg.lua +++ b/frontend/dbg.lua @@ -2,6 +2,7 @@ local dump = require("dump") local isAndroid, android = pcall(require, "android") local Dbg = { + -- set to nil so first debug:turnOff call won't be skipped is_on = nil, is_verbose = nil, ev_log = nil, diff --git a/reader.lua b/reader.lua index 5dcd86044..1ec85506b 100755 --- a/reader.lua +++ b/reader.lua @@ -77,7 +77,8 @@ end -- should check DEBUG option in arg and turn on DEBUG before loading other -- modules, otherwise DEBUG in some modules may not be printed. -local DEBUG = require("dbg") +local dbg = require("dbg") +if G_reader_settings:readSetting("debug") then dbg:turnOn() end local Profiler = nil local ARGV = arg @@ -95,9 +96,9 @@ while argidx <= #ARGV do if arg == "-h" then return showusage() elseif arg == "-d" then - DEBUG:turnOn() + dbg:turnOn() elseif arg == "-v" then - DEBUG:setVerbose(true) + dbg:setVerbose(true) elseif arg == "-p" then Profiler = require("jit.p") Profiler.start("la")