TYPO3 API  SVNRelease
EchoLogger.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 /**
00012  * Prints all log messages in real time.
00013  *
00014  * @package Swift
00015  * @subpackage Transport
00016  * @author Chris Corbyn
00017  */
00018 class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger
00019 {
00020 
00021   /** Whether or not HTML should be output */
00022   private $_isHtml;
00023 
00024   /**
00025    * Create a new EchoLogger.
00026    *
00027    * @param boolean $isHtml
00028    */
00029   public function __construct($isHtml = true)
00030   {
00031     $this->_isHtml = $isHtml;
00032   }
00033 
00034   /**
00035    * Add a log entry.
00036    * @param string $entry
00037    */
00038   public function add($entry)
00039   {
00040     if ($this->_isHtml)
00041     {
00042       printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL);
00043     }
00044     else
00045     {
00046       printf('%s%s', $entry, PHP_EOL);
00047     }
00048   }
00049 
00050   /**
00051    * Not implemented.
00052    */
00053   public function clear()
00054   {
00055   }
00056 
00057   /**
00058    * Not implemented.
00059    */
00060   public function dump()
00061   {
00062   }
00063 
00064 }