1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Log
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Joomla MessageQueue logger class.
14 *
15 * This class is designed to output logs to a specific MySQL database table. Fields in this
16 * table are based on the Syslog style of log output. This is designed to allow quick and
17 * easy searching.
18 *
19 * @since 11.1
20 */
21 class JLogLoggerMessagequeue extends JLogLogger
22 {
23 /**
24 * Method to add an entry to the log.
25 *
26 * @param JLogEntry $entry The log entry object to add to the log.
27 *
28 * @return void
29 *
30 * @since 11.1
31 */
32 public function addEntry(JLogEntry $entry)
33 {
34 switch ($entry->priority)
35 {
36 case JLog::EMERGENCY:
37 case JLog::ALERT:
38 case JLog::CRITICAL:
39 case JLog::ERROR:
40 JFactory::getApplication()->enqueueMessage($entry->message, 'error');
41 break;
42 case JLog::WARNING:
43 JFactory::getApplication()->enqueueMessage($entry->message, 'warning');
44 break;
45 case JLog::NOTICE:
46 JFactory::getApplication()->enqueueMessage($entry->message, 'notice');
47 break;
48 case JLog::INFO:
49 JFactory::getApplication()->enqueueMessage($entry->message, 'message');
50 break;
51 default:
52 // Ignore other priorities.
53 break;
54 }
55 }
56 }
57