From: Niki Roo Date: Sat, 13 Apr 2019 11:32:55 +0000 (+0200) Subject: tracer: fix DEBUG=0 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a3c355867d757f095669cb96918a96aed2b267c7;p=fanfix-jexer.git tracer: fix DEBUG=0 --- diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index a6f6fb7..c547a2b 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -43,7 +43,9 @@ public class Instance { static { // Before we can configure it: - tracer = new TraceHandler(true, checkEnv("DEBUG"), checkEnv("DEBUG")); + Boolean debug = checkEnv("DEBUG"); + boolean trace = debug != null && debug; + tracer = new TraceHandler(true, trace, trace); // config dir: configDir = getConfigDir(); @@ -53,19 +55,14 @@ public class Instance { // Most of the rest is dependent upon this: createConfigs(configDir, false); - + // Proxy support Proxy.use(Instance.getConfig().getString(Config.USE_PROXY)); // update tracer: - boolean debug = Instance.getConfig() - .getBoolean(Config.DEBUG_ERR, false); - boolean trace = Instance.getConfig().getBoolean(Config.DEBUG_TRACE, - false); - - if (checkEnv("DEBUG")) { - debug = true; - trace = true; + if (debug == null) { + debug = Instance.getConfig().getBoolean(Config.DEBUG_ERR, false); + trace = Instance.getConfig().getBoolean(Config.DEBUG_TRACE, false); } tracer = new TraceHandler(true, debug, trace); @@ -408,7 +405,8 @@ public class Instance { trans.deleteFile(configDir); } - if (checkEnv("NOUTF")) { + Boolean noutf = checkEnv("NOUTF"); + if (noutf != null && noutf) { trans.setUnicode(false); transGui.setUnicode(false); } @@ -571,7 +569,7 @@ public class Instance { * * @return TRUE if it is */ - private static boolean checkEnv(String key) { + private static Boolean checkEnv(String key) { String value = System.getenv(key); if (value != null) { value = value.trim().toLowerCase(); @@ -580,8 +578,10 @@ public class Instance { || "y".equals(value)) { return true; } + + return false; } - return false; + return null; } }