Reputation:
In PrestaShop I can display the errors with the function Tools::displayError() like this:
if (empty($email)) {
$this->errors[] = Tools::displayError('Email is empty.');
$this->doLog('ERROR: Email/username is empty');
} elseif (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid email address.');
$this->doLog('ERROR: Invalid Email address');
}
Is there a similar way to do this in OpenCart? Is there a function i can use?
Thanks
Upvotes: 2
Views: 7894
Reputation: 3224
Go To Admin Panel
Go to System > Settings
Select your store from the list and click Edit
Go to the Server tab
To display errors, change Display Errors to Yes, If you want to log errors to a file, select Yes for Log Errors
Enter in an Error Log Filename
Click Save
$logger = new Log('error.log'); //just pass the file name as error.log
$logger->write('Custom Error Message');
You will see the error file inside system-> storage-> logs-> error.log
Upvotes: 3