Skip to content

Instantly share code, notes, and snippets.

@kenng
Last active January 30, 2019 16:02
Show Gist options
  • Select an option

  • Save kenng/dcda660cf201e59f87aa8d200d868b4c to your computer and use it in GitHub Desktop.

Select an option

Save kenng/dcda660cf201e59f87aa8d200d868b4c to your computer and use it in GitHub Desktop.
php debug
public static function WriteErrorFile(String $msg) {
$fpath = base_path() . '/errors.log';
$fpath = "/Applications/AMPPS/www/lwnew.thelivingwellco.com.sg/wp-content/plugins/itwonders-woocommerce-deposit/errors.log";
error_log(print_r($msg, TRUE), 3, $fpath);
}
public static function backtrace($skip=0, $limit=12) {
$dump = [];
$mydump = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $limit);
foreach ($mydump as $key => $item) {
if ($key >= $skip) {
$myfile = isset($item['file'])?:'undefined';
$dump[] = $myfile . "::" . $item['function'];
}
}
self::WriteErrorFile(implode("\n", $dump) . "\n");
return $dump;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment