Skip to content

Instantly share code, notes, and snippets.

@noname007
Created May 11, 2017 08:30
Show Gist options
  • Select an option

  • Save noname007/f7d2f2c8842ba1fd3e668f0de47ea56a to your computer and use it in GitHub Desktop.

Select an option

Save noname007/f7d2f2c8842ba1fd3e668f0de47ea56a to your computer and use it in GitHub Desktop.
<?php
function log_error_msg($msg)
{
print_r($msg);
$_log_message[] = $msg;
$info = debug_backtrace();
$space = str_repeat(' ',4);
foreach ($info as $i){
$file = isset($i['file']) ? $i['file'] : '';
$line = isset($i['line']) ? $i['line'] : '';
$class =isset($i['class']) ? $i['class'] : '';
$function = isset($i['function']) ?$i['function'] : '';
$sep = isset($i['object']) ? "->" : "::" ;
$_log_message[]= "$space in $file:$line $class$sep$function()";
}
log_msg('[error]'.implode(PHP_EOL,$_log_message));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment