X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdebug%2Fclass_DebugErrorLogOutput.php;h=2baf7917cd398858847e1814b1a5bb4623682843;hb=6703da39c439aa4772df4c1b31aca50b577e1406;hp=59a3aabff7933b11a9aa3af4109a12ebb100eacc;hpb=361e6320e50a8bb1a3ccb675388b8042361669ae;p=core.git diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php index 59a3aabf..2baf7917 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 - 2009 Roland Haeder, this is free software + * @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 * @@ -35,9 +35,9 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu /** * Creates an instance of this class * - * @return $debugInstance The prepared debug instance + * @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 $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) { + self::createDebugInstance(__CLASS__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF]