0.3.0 inital import
[mailer.git] / inc / classes / main / debug / class_DebugErrorLogOutput.php
1 <?php
2 /**
3  * A debug output class for PHP's error_log() command
4  */
5 class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger {
6         /**
7          * Private constructor
8          *
9          * @return      void
10          */
11         private function __construct () {
12                 // Call parent constructor
13                 parent::constructor(__CLASS__);
14
15                 // Set description
16                 $this->setPartDescr("Debug-Ausgabe in error_log()");
17
18                 // Create an unique ID
19                 $this->createUniqueID();
20         }
21
22         /**
23          * Creates an instance of this class
24          *
25          * @return      $debugInstance          The prepared debug instance
26          */
27         public final static function createDebugErrorLogOutput () {
28                 // Get a new instance
29                 $debugInstance = new DebugErrorLogOutput();
30
31                 // Return it
32                 return $debugInstance;
33         }
34
35         /**
36          * Outputs the given data without HTML tags
37          *
38          * @param               $output The HTML'ed output
39          * @return      void
40          */
41         public final function outputStream ($output) {
42                 // Split multiple lines into and array to put them out line-by-line
43                 $errorLines = explode("\n", $output);
44                 foreach ($errorLines as $err) {
45                         $err = trim($err);
46                         // Log only none-empty lines
47                         if (!empty($err)) {
48                                 // Log this line
49                                 error_log(html_entity_decode(strip_tags($err)), 0);
50                         }
51                 }
52         }
53 }
54
55 // [EOF]
56 ?>