diff options
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r-- | inc/HTTPClient.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 51c1de875..8cfb86567 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -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(); @@ -684,6 +700,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 */ static function _time(){ |