noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 28/107: Debug : add function tracedebug


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 28/107: Debug : add function tracedebug
Date: Mon, 26 Aug 2019 10:31:50 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 61d6bea5b1a65362bce09cb0aeff4c58c953e472
Author: Dany De Bontridder <address@hidden>
Date:   Sun Jun 30 17:40:24 2019 +0200

    Debug : add function tracedebug
---
 include/lib/ac_common.php | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index ca7d654..86d40f4 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1325,4 +1325,26 @@ function record_log($p_message)
     error_log("noalyss GET [".var_export($_GET, true)."]",0);
     error_log( "noalyss POST [".var_export($_POST, true)."]",0);
 }
+if(!function_exists('tracedebug')) {
+  function tracedebug($file,$var, $label = NULL) {
+
+    $tmp_file = sys_get_temp_dir().DIRECTORY_SEPARATOR.$file;
+
+    $output = '';
+    $output .= date('d-m-y H:i');
+    if(!is_null($label)) {
+      $output .= $label . ': ';
+    }
+    if ( gettype ($var) == 'object' && get_class($var)=='DOMDocument')
+    {
+      $var->formatOutput=true;
+      $output.=$var->saveXML() .PHP_EOL;
+    } else
+    {
+      $output .= print_r($var, 1) . PHP_EOL;
+    }
+
+    file_put_contents($tmp_file, $output, FILE_APPEND);
+  }
+}
 ?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]