Unverified Commit e351b026 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(logging) Log debug even for index.php and POST requests

When logging DEBUG lines is active, do it even on index.php and POST
 requests to help debugging.

issue #6175
Showing with 17 additions and 14 deletions
+17 -14
...@@ -112,40 +112,43 @@ class logging ...@@ -112,40 +112,43 @@ class logging
global $config; global $config;
static $first = TRUE; static $first = TRUE;
if (($_SERVER['REQUEST_METHOD'] == 'POST') && preg_match('/index.php$/', $_SERVER['REQUEST_URI'])) {
return;
}
if (session::get('DEBUGLEVEL') & $level) { if (session::get('DEBUGLEVEL') & $level) {
$output = '';
if ($first) { if ($first) {
echo '<div id="debug-handling" class="notice">'. $output .= '<div id="debug-handling" class="notice">'.
'<img src="geticon.php?context=status&amp;icon=dialog-information&amp;size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'. '<img src="geticon.php?context=status&amp;icon=dialog-information&amp;size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'.
'There is some debug output '. 'There is some debug output '.
'<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'. '<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'.
'</div>'; '</div>';
$first = FALSE; $first = FALSE;
} }
$output = "DEBUG[$level] "; $logline = "DEBUG[$level] ";
if ($function != '') { if ($function != '') {
$output .= "($file:$function():$line) - $info: "; $logline .= "($file:$function():$line) - $info: ";
} else { } else {
$output .= "($file:$line) - $info: "; $logline .= "($file:$line) - $info: ";
} }
echo '<div class="debug_div">'; $output .= '<div class="debug_div">';
echo $output; $output .= $logline;
$logline = $output;
if (is_array($data)) { if (is_array($data)) {
print_a($data); $output .= print_a($data, TRUE);
$logline .= print_r($data, TRUE); $logline .= print_r($data, TRUE);
} else { } else {
echo "'$data'"; $output .= "'$data'";
$logline .= "'$data'"; $logline .= "'$data'";
} }
echo "</div>\n"; $output .= "</div>\n";
if (is_object($config) && preg_match('/true/i', $config->get_cfg_value('debugLogging', ''))) { if (is_object($config) && preg_match('/true/i', $config->get_cfg_value('debugLogging', ''))) {
fusiondirectory_log($logline); fusiondirectory_log($logline);
} }
if (($_SERVER['REQUEST_METHOD'] == 'POST') && preg_match('/index.php$/', $_SERVER['REQUEST_URI'])) {
return;
}
echo $output;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment