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 Echo logger class.
14 *
15 * @since 11.1
16 */
17 class JLogLoggerEcho extends JLogLogger
18 {
19 /**
20 * Value to use at the end of an echoed log entry to separate lines.
21 *
22 * @var string
23 * @since 11.1
24 */
25 protected $line_separator = "\n";
26
27 /**
28 * Constructor.
29 *
30 * @param array &$options Log object options.
31 *
32 * @since 12.1
33 */
34 public function __construct(array &$options)
35 {
36 parent::__construct($options);
37
38 if (!empty($this->options['line_separator']))
39 {
40 $this->line_separator = $this->options['line_separator'];
41 }
42 }
43
44 /**
45 * Method to add an entry to the log.
46 *
47 * @param JLogEntry $entry The log entry object to add to the log.
48 *
49 * @return void
50 *
51 * @since 11.1
52 */
53 public function addEntry(JLogEntry $entry)
54 {
55 echo $this->priorities[$entry->priority] . ': '
56 . $entry->message . (empty($entry->category) ? '' : ' [' . $entry->category . ']')
57 . $this->line_separator;
58 }
59 }
60