Logger.php
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Log;
defined('JPATH_PLATFORM') or die;
/**
* Joomla! Logger Base Class
*
* This class is used to be the basis of logger classes to allow for defined functions
* to exist regardless of the child class.
*
* @since 3.0.1
*/
abstract class Logger
{
/**
* Options array for the JLog instance.
*
* @var array
* @since 3.0.1
*/
protected $options = array();
/**
* Translation array for LogEntry priorities to text strings.
*
* @var array
* @since 3.0.1
*/
protected $priorities = array(
Log::EMERGENCY => 'EMERGENCY',
Log::ALERT => 'ALERT',
Log::CRITICAL => 'CRITICAL',
Log::ERROR => 'ERROR',
Log::WARNING => 'WARNING',
Log::NOTICE => 'NOTICE',
Log::INFO => 'INFO',
Log::DEBUG => 'DEBUG',
);
/**
* Constructor.
*
* @param array &$options Log object options.
*
* @since 3.0.1
*/
public function __construct(array &$options)
{
// Set the options for the class.
$this->options = & $options;
}
/**
* Method to add an entry to the log.
*
* @param LogEntry $entry The log entry object to add to the log.
*
* @return void
*
* @since 3.0.1
* @throws \RuntimeException
*/
abstract public function addEntry(LogEntry $entry);
}