Skip to content

Instantly share code, notes, and snippets.

@NadirZenith
Forked from jehoshua02/kint_log.php
Created April 26, 2014 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NadirZenith/11324930 to your computer and use it in GitHub Desktop.
Save NadirZenith/11324930 to your computer and use it in GitHub Desktop.
<?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