0.3.0 inital import
[mailer.git] / inc / classes / main / debug / class_DebugErrorLogOutput.php
diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php
new file mode 100644 (file)
index 0000000..eebf0bb
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+/**
+ * A debug output class for PHP's error_log() command
+ */
+class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::constructor(__CLASS__);
+
+               // Set description
+               $this->setPartDescr("Debug-Ausgabe in error_log()");
+
+               // Create an unique ID
+               $this->createUniqueID();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $debugInstance          The prepared debug instance
+        */
+       public final static function createDebugErrorLogOutput () {
+               // Get a new instance
+               $debugInstance = new DebugErrorLogOutput();
+
+               // Return it
+               return $debugInstance;
+       }
+
+       /**
+        * Outputs the given data without HTML tags
+        *
+        * @param               $output The HTML'ed output
+        * @return      void
+        */
+       public final function outputStream ($output) {
+               // Split multiple lines into and array to put them out line-by-line
+               $errorLines = explode("\n", $output);
+               foreach ($errorLines as $err) {
+                       $err = trim($err);
+                       // Log only none-empty lines
+                       if (!empty($err)) {
+                               // Log this line
+                               error_log(html_entity_decode(strip_tags($err)), 0);
+                       }
+               }
+       }
+}
+
+// [EOF]
+?>