Skip to content

Instantly share code, notes, and snippets.

@jeremejazz
Created March 19, 2013 05:11
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 jeremejazz/5193855 to your computer and use it in GitHub Desktop.
Save jeremejazz/5193855 to your computer and use it in GitHub Desktop.
Class for Error Logging
<?php
class JErrors{
private $filename = '';
/*
@param filename
*/
function __construct($file) {
$this->filename = $file;
$filename=$file;
}
function __destruct() {
}
/*Display Error Message and Save to Textfile*/
function error_message($message, $file = ''){
if($file == ''){
$file = $this->filename;
}
$text = date('H:i:s Y-d-m') . ' ' . $message . "\n"; //for error file
error_log($message,0); //display to user
if($file != ''){
error_log($text,3,$file);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment