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! Logger Base Class
14 *
15 * This class is used to be the basis of logger classes to allow for defined functions
16 * to exist regardless of the child class.
17 *
18 * @since 12.2
19 */
20 abstract class JLogLogger
21 {
22 /**
23 * Options array for the JLog instance.
24 *
25 * @var array
26 * @since 12.2
27 */
28 protected $options = array();
29
30 /**
31 * Translation array for JLogEntry priorities to text strings.
32 *
33 * @var array
34 * @since 12.2
35 */
36 protected $priorities = array(
37 JLog::EMERGENCY => 'EMERGENCY',
38 JLog::ALERT => 'ALERT',
39 JLog::CRITICAL => 'CRITICAL',
40 JLog::ERROR => 'ERROR',
41 JLog::WARNING => 'WARNING',
42 JLog::NOTICE => 'NOTICE',
43 JLog::INFO => 'INFO',
44 JLog::DEBUG => 'DEBUG',
45 );
46
47 /**
48 * Constructor.
49 *
50 * @param array &$options Log object options.
51 *
52 * @since 12.2
53 */
54 public function __construct(array &$options)
55 {
56 // Set the options for the class.
57 $this->options = & $options;
58 }
59
60 /**
61 * Method to add an entry to the log.
62 *
63 * @param JLogEntry $entry The log entry object to add to the log.
64 *
65 * @return void
66 *
67 * @since 12.2
68 * @throws RuntimeException
69 */
70 abstract public function addEntry(JLogEntry $entry);
71 }
72
73 /**
74 * Deprecated class placeholder. You should use JLogLogger instead.
75 *
76 * @since 11.1
77 * @deprecated 13.3 (Platform) & 4.0 (CMS)
78 * @codeCoverageIgnore
79 */
80 abstract class JLogger extends JLogLogger
81 {
82 /**
83 * Constructor.
84 *
85 * @param array &$options Log object options.
86 *
87 * @since 11.1
88 * @deprecated 13.3
89 */
90 public function __construct(array &$options)
91 {
92 JLog::add('JLogger is deprecated. Use JLogLogger instead.', JLog::WARNING, 'deprecated');
93 parent::__construct($options);
94 }
95 }
96