diff --git a/src/class.seostats.config.php b/src/class.seostats.config.php index 119c68a5..dbe623e4 100644 --- a/src/class.seostats.config.php +++ b/src/class.seostats.config.php @@ -39,4 +39,7 @@ 'member-881a55bcfb'); define('SEOMOZ_SECRET_KEY', '7145d56a1279285be92e6e4875bba8ee'); + + define('ERR_LOG_ENABLED', true); + define('ERR_LOG_PATH', 'errlog.txt'); ?> diff --git a/src/class.seostats.php b/src/class.seostats.php index c742c7a1..1eb7ed13 100644 --- a/src/class.seostats.php +++ b/src/class.seostats.php @@ -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); + } } /**