| core_lang

# Class: Bs_XRay Source Location: /core/lang/Bs_XRay.class.php
### Class Overview
BS XRay - BS Language Component(*) Collection of debugging methods #### Author(s): Sam Blum <at blueshoes dot org> #### Copyright: blueshoes.org | ### Methods activateOnIP dump echoHtml echoPre funcEnd funcStart _msgInfoLine
### Inherited Variables | ### Inherited Methods
### Class Details [line 60] BS XRay - BS Language Component(*) Collection of debugging methods *) BS Language Components are collection of function and/or classes that are not inherited by Bs_Object AND are not dependent on any other classes or libs that use Bs_Object (to avoid cyclic dependences). For comfort some short hand function have been defined that use this class. XR_isOn(); XR_echo ($msg, $_line_='', $_func_='', $_file_=''); // Use instead of PHP's echo XR_echoPre ($msg, $_line_='', $_func_='', $_file_=''); // Use instead of PHP's echo XR_dump ($foo, $_line_='', $_func_='', $_file_=''); // Use instead of PHP's var_dump() of print_r() The Problem (to solve): ----------------------- While a silple PHP echo or var_dump() are simple function to use to do some simple debugging, there is a major drawback: You CAN'T use them in a *life* system. All the useres would see the output too. So how can you output info, that is only intended for the developer? The Solution: ------------- Set a flag if request comes for a defined (developer) IP. Trace- and Debbug- function output only if request come for that given IP. Usage: ------ Per default all XR-function will react if the requst IP is 'localhost' To set the IP(s) call: Bs_XRay::activateOnIP($IPs); Depending on the callers IP, the GLOBAL flag: $XR_isOn is set to TRUE or FALSE. For performance reasons it's allowed to use the flag directy OR call XR_isOn() (2ed option costs a little more CPU, I think). E.g. : if ($GLOBALS['XR_isOn']) { / * trace something * / } OR if (XR_isOn()) { / * trace something * / } #### Tags:
copyright: | blueshoes.org
author: | Sam Blum <at blueshoes dot org>
[ Top ] ### Class Methods ### method activateOnIP [line 69]
`void activateOnIP( [$IPs $IPs = array()])`
Define the IP (or IP's) that will activate XRay. That is set $XR_isOn to TRUE. The param can be an IP-string eg: '12.122.232.2' or array of IP-strings IP's can have '*' as wildcard. Froms like '12.2.' have the same meaning as '12.2.*.*' NOTE: If XRay is on, then PHP error reporting is set to E_ALL too. #### Parameters:
$IPs | $IPs | mixed array or string (see text above)
[ Top ] ### method dump [line 111]
`void dump( mixed $msg, [mixed $_line_ = ''], [mixed $_func_ = ''], [mixed $_file_ = ''])`
Use instead of PHP's var_dump() or print_r() [ Top ] ### method echoHtml [line 89]
`void echoHtml( mixed $msg, [mixed $_line_ = ''], [mixed $_func_ = ''], [mixed $_file_ = ''])`
Use instead of PHP's echo [ Top ] ### method echoPre [line 100]
`void echoPre( mixed $msg, [mixed $_line_ = ''], [mixed $_func_ = ''], [mixed $_file_ = ''])`
Use instead of PHP's echo. (Puts output in a [ Top ] ### method funcEnd [line 148]
`void funcEnd( [mixed $_line_ = ''], [mixed $_func_ = ''], [mixed $_file_ = ''], mixed $comment)`
[ Top ] ### method funcStart [line 139]
`void funcStart( [mixed $_line_ = ''], [mixed $_func_ = ''], [mixed $_file_ = ''], mixed $comment)`
[ Top ] ### method _msgInfoLine [line 128]
`void _msgInfoLine( mixed $_line_, mixed $_func_, mixed $_file_)`
Render the msg line [ Top ] Documentation generated on Mon, 29 Dec 2003 21:13:31 +0100 by phpDocumentor 1.2.3