Skip to content

Instantly share code, notes, and snippets.

@datamafia
Created May 22, 2014 17:07
Show Gist options
  • Save datamafia/d15c7ed1d3fe61994f69 to your computer and use it in GitHub Desktop.
Save datamafia/d15c7ed1d3fe61994f69 to your computer and use it in GitHub Desktop.
Simple Work in Progress PHP Error Reporting to Terminal
// (c) copyright Data Mafia LLC MIT license : http://opensource.org/licenses/MIT
class foo{
/* Deliver message via PHP error_log
* @param $msg : optional. string, obj, or array
* @return : void
*/
function e($msg=false){
if(!$msg){
$msg = 'at line number '.__LINE__;
}
if(is_object($msg) || is_array($msg)){
$msg = var_export($msg, true);
}
error_log('[ADD SOMETHING HERE] file : '
.__file__.' class : '.get_class($this).' method : '.__FUNCTION__
.' custom message :'.$msg
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment