Last active
October 4, 2015 21:07
-
-
Save craiga/2699763 to your computer and use it in GitHub Desktop.
_logDump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Dump the output of var_dump to a log file. | |
* | |
* Dump the output of var_dump to a log file. Requires {@link https://gist.github.com/1849563 this _log function}. | |
* | |
* @author Craig Anderson <[email protected]> | |
* @link https://gist.github.com/gists/2699763 | |
*/ | |
protected function _logDump($var) | |
{ | |
$originalSetting = ini_get("xdebug.overload_var_dump"); | |
if(!ini_set("xdebug.overload_var_dump", false)) | |
{ | |
// Couldn't override the xdebug.overload_var_dump setting; ignore. | |
} | |
ob_start(); | |
var_dump($var); | |
$dump = ob_get_clean(); | |
ini_set("xdebug.overload_var_dump", $originalSetting); | |
$this->_log($var); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment