Skip to content

Instantly share code, notes, and snippets.

@ob-ivan
Last active December 31, 2015 00:29
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 ob-ivan/7907342 to your computer and use it in GitHub Desktop.
Save ob-ivan/7907342 to your computer and use it in GitHub Desktop.
<?php
error_log(__METHOD__ . ':' . __LINE__); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': message'); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': gettype($value) = ' . gettype($value)); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': get_class($object) = ' . get_class($object)); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': $class is defined in ' . (new ReflectionClass($class))->getFileName()); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': $variable = ' . var_export($variable, true)); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': $variable = ' . print_r($variable, true)); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': debug_backtrace = ' . print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true)); // debug
error_log(__METHOD__ . ':' . __LINE__ . ': debug_backtrace = ' . var_export(array_map(
function ($a) { return isset($a['file'])
? $a['file'] . ':' . $a['line']
: $a['function']
;
},
debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)
), true)); // debug
for ($p = $e, $a = []; $p; $p = $p->getPrevious()) {
$a[] = __METHOD__ . ':' . __LINE__ . ': ' . get_class($p) . ' (' . $p->getCode() . ') "' . $p->getMessage() . '"' . "\n" .
$p->getFile() . ':' . $p->getLine() . "\n" .
$p->getTraceAsString();
}
$m = implode("\n", $a);
error_log($m); // debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment