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: /** Whether or not HTML should be output */
21: private $_isHtml;
22:
23: /**
24: * Create a new EchoLogger.
25: *
26: * @param boolean $isHtml
27: */
28: public function __construct($isHtml = true)
29: {
30: $this->_isHtml = $isHtml;
31: }
32:
33: /**
34: * Add a log entry.
35: * @param string $entry
36: */
37: public function add($entry)
38: {
39: if ($this->_isHtml) {
40: printf('%s%s%s', conHtmlSpecialChars($entry, ENT_QUOTES), '<br />', PHP_EOL);
41: } else {
42: printf('%s%s', $entry, PHP_EOL);
43: }
44: }
45:
46: /**
47: * Not implemented.
48: */
49: public function clear()
50: {
51: }
52:
53: /**
54: * Not implemented.
55: */
56: public function dump()
57: {
58: }
59: }
60: