From 3002300556c610c15371d587c971cdc06d807ac5 Mon Sep 17 00:00:00 2001 From: heck Date: Sun, 7 Mar 2021 17:50:15 +0100 Subject: [PATCH] PityTest: TestLogger - correct static initialization --- .../foundation/pEp/pitytest/TestLogger.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/java/foundation/pEp/pitytest/TestLogger.java b/test/java/foundation/pEp/pitytest/TestLogger.java index d5618a4..73c01fd 100644 --- a/test/java/foundation/pEp/pitytest/TestLogger.java +++ b/test/java/foundation/pEp/pitytest/TestLogger.java @@ -13,17 +13,23 @@ public class TestLogger { } // options - private static boolean logEnabled = true; + private static boolean logEnabled; private static int lineWidth; // constants - private static int threadStrLen = 10; - private static String threadSeparator = ": "; - private static boolean initialized = false; + private static int threadStrLen; + private static String threadSeparator; + private static boolean initialized; private static void init() { if (!initialized) { + logEnabled = true; + threadStrLen = 10; + lineWidth = 80; + threadSeparator = ": "; + tryDetermineTermSize(); + logRaw("ENVCOL:" + TestUtils.getEnvVar("COLUMNS")); initialized = true; } } @@ -40,10 +46,9 @@ public class TestLogger { cmdOutput += buf; } - log("TERMSIZE: " + cmdOutput); - nrCols = Integer.valueOf(cmdOutput); setLineWidth(clip(nrCols, 40, 2000)); + } catch (Exception e) { // something went wrong }