本文整理汇总了PHP中PrestaShopLogger::sendByMail方法的典型用法代码示例。如果您正苦于以下问题:PHP PrestaShopLogger::sendByMail方法的具体用法?PHP PrestaShopLogger::sendByMail怎么用?PHP PrestaShopLogger::sendByMail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrestaShopLogger
的用法示例。
在下文中一共展示了PrestaShopLogger::sendByMail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLog
/**
* add a log item to the database and send a mail if configured for this $severity
*
* @param string $message the log message
* @param int $severity
* @param int $error_code
* @param string $object_type
* @param int $object_id
* @param bool $allow_duplicate if set to true, can log several time the same information (not recommended)
* @return bool true if succeed
*/
public static function addLog($message, $severity = 1, $error_code = null, $object_type = null, $object_id = null, $allow_duplicate = false, $id_employee = null)
{
$log = new PrestaShopLogger();
$log->severity = (int) $severity;
$log->error_code = (int) $error_code;
$log->message = pSQL($message);
$log->date_add = date('Y-m-d H:i:s');
$log->date_upd = date('Y-m-d H:i:s');
if ($id_employee === null && isset(Context::getContext()->employee) && Validate::isLoadedObject(Context::getContext()->employee)) {
$id_employee = Context::getContext()->employee->id;
}
if ($id_employee !== null) {
$log->id_employee = (int) $id_employee;
}
if (!empty($object_type) && !empty($object_id)) {
$log->object_type = pSQL($object_type);
$log->object_id = (int) $object_id;
}
if ($object_type != 'Swift_Message') {
PrestaShopLogger::sendByMail($log);
}
if ($allow_duplicate || !$log->_isPresent()) {
$res = $log->add();
if ($res) {
self::$is_present[$log->getHash()] = isset(self::$is_present[$log->getHash()]) ? self::$is_present[$log->getHash()] + 1 : 1;
return true;
}
}
return false;
}