Last active
November 1, 2017 10:25
-
-
Save jehoshua02/8137742 to your computer and use it in GitHub Desktop.
Just an idea for logging kint to file instead of screen.
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 | |
require_once __DIR__ . '/vendor/autoload.php'; | |
define('KINT_LOG', '/vagrant/logs/kint.log.html'); | |
/** | |
* Logs Kint::dump() to file | |
*/ | |
function l() | |
{ | |
if ( !Kint::enabled() ) return; | |
$args = func_get_args(); | |
foreach ($args as $arg) { | |
$dump = @Kint::dump($arg); | |
$content = sprintf('%s:<br />%s', date('Y-m-d H:i:s'), $dump); | |
file_put_contents(KINT_LOG, $content); | |
} | |
} | |
/** | |
* Logs Kint::dump() to file | |
* [!!!] IMPORTANT: execution will halt after call to this function | |
*/ | |
function ld() | |
{ | |
if ( !Kint::enabled() ) return; | |
$args = func_get_args(); | |
call_user_func_array('l', $args); | |
die; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment