X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdebug%2Fclass_DebugErrorLogOutput.php;h=22fe5598f367ccf81e1f1bfd8f2b26d1c83f6670;hb=e6fa5aeb4f807fb3d5f3b025faced65ede4140dd;hp=fcc7f65952c95c6a062bd68c4751e8bd53956a3c;hpb=0cd57c3885f00ad77fc599e53ed2f2d5e7ac267f;p=core.git diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php index fcc7f659..22fe5598 100644 --- a/inc/classes/main/debug/class_DebugErrorLogOutput.php +++ b/inc/classes/main/debug/class_DebugErrorLogOutput.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -37,7 +37,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu * * @return $debugInstance The prepared debug instance */ - public final static function createDebugErrorLogOutput () { + public static final function createDebugErrorLogOutput () { // Get a new instance $debugInstance = new DebugErrorLogOutput(); @@ -46,47 +46,54 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu } /** - * Outputs the given data without HTML tags + * Outputs the given data without HTML tags, ignores $stripTags * * @param $output The HTML'ed output + * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function outputStream ($output) { + public final function outputStream ($output, $stripTags = false) { // Split multiple lines into and array to put them out line-by-line - $errorLines = explode("\n", $output); + $errorLines = explode(chr(10), $output); + + // "Walk" through all lines foreach ($errorLines as $err) { + // Trim any spaces, \n, \r etc. out $err = trim($err); + // Log only none-empty lines if (!empty($err)) { // Log this line error_log(html_entity_decode(strip_tags($err)), 0); - } - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - // Empty stub! - trigger_error(__METHOD__.": Stub!"); + } // END - if + } // END - foreach } /** * Output the code * + * @param $outStream Stream to output + * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = false) { + public final function output ($outStream = false, $stripTags = false) { // Empty output will be silently ignored if ($outStream !== false) { $this->outputStream($outStream); } } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF]