|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of SwiftMailer. |
|
|
5 |
* (c) 2004-2009 Chris Corbyn |
|
|
6 |
* |
|
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
|
8 |
* file that was distributed with this source code. |
|
|
9 |
*/ |
|
|
10 |
|
|
|
11 |
/** |
|
|
12 |
* Prints all log messages in real time. |
|
|
13 |
* |
|
|
14 |
* @package Swift |
|
|
15 |
* @subpackage Transport |
|
|
16 |
* @author Chris Corbyn |
|
|
17 |
*/ |
|
|
18 |
class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger |
|
|
19 |
{ |
|
|
20 |
|
|
|
21 |
/** Whether or not HTML should be output */ |
|
|
22 |
private $_isHtml; |
|
|
23 |
|
|
|
24 |
/** |
|
|
25 |
* Create a new EchoLogger. |
|
|
26 |
* |
|
|
27 |
* @param boolean $isHtml |
|
|
28 |
*/ |
|
|
29 |
public function __construct($isHtml = true) |
|
|
30 |
{ |
|
|
31 |
$this->_isHtml = $isHtml; |
|
|
32 |
} |
|
|
33 |
|
|
|
34 |
/** |
|
|
35 |
* Add a log entry. |
|
|
36 |
* @param string $entry |
|
|
37 |
*/ |
|
|
38 |
public function add($entry) |
|
|
39 |
{ |
|
|
40 |
if ($this->_isHtml) |
|
|
41 |
{ |
|
|
42 |
printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL); |
|
|
43 |
} |
|
|
44 |
else |
|
|
45 |
{ |
|
|
46 |
printf('%s%s', $entry, PHP_EOL); |
|
|
47 |
} |
|
|
48 |
} |
|
|
49 |
|
|
|
50 |
/** |
|
|
51 |
* Not implemented. |
|
|
52 |
*/ |
|
|
53 |
public function clear() |
|
|
54 |
{ |
|
|
55 |
} |
|
|
56 |
|
|
|
57 |
/** |
|
|
58 |
* Not implemented. |
|
|
59 |
*/ |
|
|
60 |
public function dump() |
|
|
61 |
{ |
|
|
62 |
} |
|
|
63 |
|
|
|
64 |
} |