From a3c355867d757f095669cb96918a96aed2b267c7 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 13 Apr 2019 13:32:55 +0200 Subject: [PATCH] tracer: fix DEBUG=0 --- src/be/nikiroo/fanfix/Instance.java | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index a6f6fb75..c547a2b1 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; } } -- 2.27.0