From 8bbfa91b4a5c5754e1d6d8d020dd61e52c988825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne@informatik.uni-halle.de> Date: Fri, 13 Dec 2024 15:23:51 +0100 Subject: [PATCH] - added logging to file --- constants.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/constants.php b/constants.php index 871e258..ce4b631 100644 --- a/constants.php +++ b/constants.php @@ -6,8 +6,8 @@ $versionString = '2.9.1'; $rootDirNameToUseString = 'work'; -$isDebug = false; //logs debug to STDOUT -$debugOutputAllReturnOutput = false; //if true && $isDebug every response is also written to STDOUT +$isDebug = true; //logs debug (only if next line is true too) +$debugOutputAllReturnOutput = false; //if true && $isDebug every response is also written to a file $s_testServerCode = 'testServerCode'; # the test server code for one test $s_testServerMessage = 'testServerMessage'; # the test server message for one test @@ -176,10 +176,6 @@ function output($responseCode, $message, $data = null) global $s_timings_string_separator; global $debugTimings; - if ($isDebug && $debugOutputAllReturnOutput) { - fwrite(STDOUT, $message); - } - $responseObj = array( 'responseCode' => $responseCode, 'message' => $message, @@ -189,6 +185,12 @@ function output($responseCode, $message, $data = null) $responseString = json_encode($responseObj); + # make sure the file exist and is write/readable! + if ($isDebug && $debugOutputAllReturnOutput) { + #fwrite(STDOUT, $message); + file_put_contents('debugLogging.log', $responseString, FILE_APPEND); + } + echo $responseString; } -- GitLab