Skip to content

Commit

Permalink
Merge pull request eyecatchup#12 from baldurrensch/disable_err_log
Browse files Browse the repository at this point in the history
Added switch to error log
  • Loading branch information
Stephan Schmitz committed May 25, 2012
2 parents 7e10cf8 + 653c59c commit b638651
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/class.seostats.config.php
Expand Up @@ -39,4 +39,7 @@
'member-881a55bcfb');
define('SEOMOZ_SECRET_KEY',
'7145d56a1279285be92e6e4875bba8ee');

define('ERR_LOG_ENABLED', true);
define('ERR_LOG_PATH', 'errlog.txt');
?>
16 changes: 11 additions & 5 deletions src/class.seostats.php
Expand Up @@ -128,13 +128,19 @@ public function __construct($url)
}
}

/**
* Logs an error to the error log file
*
* @param String $errtxt The error message to log
*/
function errlogtxt($errtxt)
{
$fp = fopen('errlog.txt','a+'); //ouvrir le fichier
$newerr = date('Y-m-d\TH:i:sP') .' : ' . $errtxt."\r\n"; //creation du texte de l'erreur
fwrite($fp,$newerr); //edition du fichier texte
fclose($fp); //fermeture du fichier texte
echo $newerr;
if (ERR_LOG_ENABLED) {
$fp = fopen(ERR_LOG_PATH,'a+');
$newerr = date('Y-m-d\TH:i:sP') .' : ' . $errtxt."\r\n";
fwrite($fp,$newerr);
fclose($fp);
}
}

/**
Expand Down

0 comments on commit b638651

Please sign in to comment.