Skip to content
Snippets Groups Projects
Commit 78361632 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

better HTTPClient debug output on CLI

parent 36625b96
No related branches found
No related tags found
No related merge requests found
......@@ -669,10 +669,26 @@ class HTTPClient {
/**
* print debug info
*
* Uses _debug_text or _debug_html depending on the SAPI name
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _debug($info,$var=null){
if(!$this->debug) return;
if(php_sapi_name() == 'cli'){
$this->_debug_text($info, $var);
}else{
$this->_debug_html($info, $var);
}
}
/**
* print debug info as HTML
*
* @param $info
* @param null $var
*/
function _debug_html($info, $var=null){
print '<b>'.$info.'</b> '.($this->_time() - $this->start).'s<br />';
if(!is_null($var)){
ob_start();
......@@ -683,6 +699,18 @@ class HTTPClient {
}
}
/**
* prints debug info as plain text
*
* @param $info
* @param null $var
*/
function _debug_text($info, $var=null){
print '*'.$info.'* '.($this->_time() - $this->start)."s\n";
if(!is_null($var)) print_r($var);
print "\n-----------------------------------------------\n";
}
/**
* Return current timestamp in microsecond resolution
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment