Example #1
0
File: log.php Project: Rikisha/proj
 /**
  * Log a entry into log.
  * 
  * @param string Message
  * @param string File name, usae current date otherwise
  * @param boolean Use to force the logging
  */
 public static function addEntry($priority, $msg, $category = null, $data = null)
 {
     try {
         if (!self::$langIsLoaded) {
             self::$langIsLoaded = self::loadTranslations();
         }
         // Cant use it because or we cant log WARNINGS AND NOTICES
         // or we wil log ALL WARNINGS AND NOTICES even J! deprecated messages..Baad.
         //$logEntry = new JLogEntry(
         //	$msg,
         //	$priority,
         //	$category,
         //	date('Y-m-d H:i:s'));
         //
         //$logEntry->params = json_encode($data);
         //@JLog::add($logEntry);
         // To avoid infinit looping if something wrong with JTable::getInstance()
         require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables' . DS . 'log.php';
         $table = new NewsletterTableLog(JFactory::getDbo());
         $table->save(array('message' => JText::_($msg), 'priority' => $priority, 'category' => $category, 'date' => date('Y-m-d H:i:s'), 'params' => $data));
     } catch (Exception $e) {
         return false;
     }
     return true;
 }