As you know var_dump() in addition to value show its data type and length.
Is there any way to log its output to
I always use this script in combination with Zend_Log_Writer_Firebug (using firephp http://www.firephp.org/), because after redirects in the applicaton or ajax requests debugging with xdebug does not always work as expected:
require_once '/Zend/Log.php';
require_once '/Zend/Log/Writer/Firebug.php';
require_once '/Zend/Controller/Response/Http.php';
require_once '/Zend/Controller/Request/Http.php';
// create the logger and log writer
$writer = new Zend_Log_Writer_Firebug();
$logger = new Zend_Log($writer);
// get the wildfire channel
$channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
// create and set the HTTP response
$response = new Zend_Controller_Response_Http();
$channel->setResponse($response);
// create and set the HTTP request
$channel->setRequest(new Zend_Controller_Request_Http());
// record log messages
$logger->info('test');
$logger->info(var_export($_SESSION,true));
$logger->info(count(var_export($_SESSION,true)));
$logger->info(strlen(var_export('hello',true)));
$logger->info(get_type($_SESSION,true));
// insert the wildfire headers into the HTTP response
$channel->flush();
// send the HTTP response headers
$response->sendHeaders();
You can build your own library to get the type of a variable:
Using a function call to var_dump_ret as argument for $logger->info() might be helpful, too. I haven't tested it yet.
function var_dump_ret($mixed = null) {
ob_start();
var_dump($mixed);
$content = ob_get_contents();
ob_end_clean();
return $content;
}