From 9b3aaa36e632185c5dd838eda214397daf5a6357 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 16 Mar 2008 13:14:58 +0000 Subject: [PATCH] BRISK_SINGLE_SESS and BRISK_SINGLE_DEBUG added, some log move from _read to _lock --- web/Obj/brisk.phh | 90 ++++++++++++++++++++++++++------------- web/briskin5/index_rd.php | 6 +-- web/index_rd.php | 6 +-- 3 files changed, 67 insertions(+), 35 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 03d1904..30d7cef 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -50,6 +50,9 @@ define(DBG_LOAD, 0x0100); define(DBG_AUTH, 0x0200); define(BRISK_DEBUG, 0); + +define(BRISK_SINGLE_DEBUG,0); +define(BRISK_SINGLE_SESS, ""); // define(DEBUGGING, "local"); $G_false = FALSE; @@ -1428,16 +1431,19 @@ function make_seed() function log_only2($log) { - if ((BRISK_DEBUG & DBG_ONL2) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONL2) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONL2) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("ONL2: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1445,16 +1451,19 @@ function log_only2($log) { } function log_only($log) { - if ((BRISK_DEBUG & DBG_ONLY) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_ONLY) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_ONLY) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("ONLY: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1462,16 +1471,19 @@ function log_only($log) { } function log_main($log) { - if ((BRISK_DEBUG & DBG_MAIN) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_MAIN) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_MAIN) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("MAIN: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1479,16 +1491,19 @@ function log_main($log) { } function log_rd($log) { - if ((BRISK_DEBUG & DBG_READ) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_READ) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; - + + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_READ) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("READ: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1496,16 +1511,18 @@ function log_rd($log) { } function log_rd2($log) { - if ((BRISK_DEBUG & DBG_REA2) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_REA2) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_REA2) == 0) + return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("REA2: [%s] [%s]\n", $ssess, $log)); @@ -1514,16 +1531,19 @@ function log_rd2($log) { } function log_send($log) { - if ((BRISK_DEBUG & DBG_SEND) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_SEND) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_SEND) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("SEND: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1531,16 +1551,19 @@ function log_send($log) { } function log_lock($log) { - if ((BRISK_DEBUG & DBG_LOCK) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOCK) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOCK) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("LOCK: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1548,16 +1571,19 @@ function log_lock($log) { } function log_wr($log) { - if ((BRISK_DEBUG & DBG_WRIT) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_WRIT) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_WRIT) == 0) + return; + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("WRIT: [%s] [%s]\n", $ssess, $log)); fclose($fp); @@ -1565,15 +1591,18 @@ function log_wr($log) { } function log_load($log) { - if ((BRISK_DEBUG & DBG_LOAD) == 0) - return; - GLOBAL $sess; + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_LOAD) == 0) + return; + if (isset($sess) == FALSE) $ssess = "XXXX"; else $ssess = $sess; + + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_LOAD) == 0) + return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { fwrite($fp, sprintf("LOAD: [%s] [%s]\n", $ssess, $log)); @@ -1582,7 +1611,10 @@ function log_load($log) { } function log_auth($sess, $log) { - if ((BRISK_DEBUG & DBG_AUTH) == 0) + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_AUTH) == 0) + return; + + if (( (BRISK_DEBUG | ($sess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_AUTH) == 0) return; if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { diff --git a/web/briskin5/index_rd.php b/web/briskin5/index_rd.php index 90679de..fddb5a2 100644 --- a/web/briskin5/index_rd.php +++ b/web/briskin5/index_rd.php @@ -99,7 +99,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $first_loop = FALSE; } - log_only("U"); + log_lock("U"); Briskin5::unlock_data($sem); ignore_user_abort(FALSE); } @@ -111,7 +111,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su // log_rd2("Postget".$proxy_step."zizi"); if ($cur_step == $proxy_step) { - log_only2("P"); + log_lock("P"); return (FALSE); } else { @@ -128,7 +128,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if (($sem = Briskin5::lock_data($table_idx)) == FALSE) break; - log_only("P"); + log_lock("P"); if (($bri = &Briskin5::load_data($table_idx, $table_token)) == FALSE) break; } while (0); diff --git a/web/index_rd.php b/web/index_rd.php index 4e03b74..84f00f8 100644 --- a/web/index_rd.php +++ b/web/index_rd.php @@ -96,7 +96,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su $first_loop = FALSE; } - log_only("U"); + log_lock("U"); Room::unlock_data($sem); ignore_user_abort(FALSE); } @@ -108,7 +108,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su // log_rd2("Postget".$proxy_step."zizi"); if ($cur_step == $proxy_step) { - log_only2("P"); + log_lock("P"); return (FALSE); } else { @@ -125,7 +125,7 @@ function maincheck($sess, $cur_stat, $cur_subst, $cur_step, &$new_stat, &$new_su if (($sem = Room::lock_data()) == FALSE) break; - log_only("P"); + log_lock("P"); if (($room = &Room::load_data()) == FALSE) break; } while (0); -- 2.17.1