UPGRADE NOTE: Do not edit or add to this file if you wish to upgrade AbanteCart to newer versions in the future. If you wish to customize AbanteCart for your needs please refer to http://www.AbanteCart.com for more information. ------------------------------------------------------------------------------*/ if (! defined ( 'DIR_CORE' )) { header ( 'Location: static_pages/' ); } /** * Class ALog */ final class ALog { private $filename; private $mode=true; /** * @param string $filename */ public function __construct($filename) { if(is_dir($filename)){ $filename .= (substr($filename,-1)!='/' ? '/' : '').'error.txt'; } $this->filename = $filename; if(class_exists('Registry')){// for disabling via settings $registry = Registry::getInstance(); if(is_object($registry->get('config'))){ $this->mode = $registry->get('config')->get('config_error_log') ? true : false; } } } /** * @param string $message */ public function write($message) { if(!$this->mode) return null; $file = $this->filename; $handle = fopen($file, 'a+'); fwrite($handle, date('Y-m-d G:i:s') . ' - ' . $message . "\n"); fclose($handle); } }