]> git.mxchange.org Git - core.git/blobdiff - framework/main/middleware/debug/class_DebugMiddleware.php
Continued:
[core.git] / framework / main / middleware / debug / class_DebugMiddleware.php
index 13fe73daf9a9af504636a701d99cff4d1f666586..dae80dbba3cada78a2e10ab1148c4ae579956599 100644 (file)
@@ -199,7 +199,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('TRACE: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -231,7 +231,39 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('DEBUG: %s', $message), $stripTags);
+
+               // Trace message
+               //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
+       }
+
+       /**
+        * Outputs an informational message whether to debug instance (should be set!) or
+        * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
+        * ApplicationEntryPoint::app_exit(), this would cause an endless loop.
+        *
+        * @param       $message        Message we shall send out...
+        * @param       $doPrint        Whether print or die here (default: print)
+        * @paran       $stripTags      Whether to strip tags (default: false)
+        * @return      void
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
+        * @throws      NullPointerException    If this->outputInstance is NULL
+        * @todo        Remove $doPrint parameter
+        */
+       public function infoMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+               // Check parameter
+               //* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
+               if (empty($message)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               } elseif (is_null($this->getOutputInstance())) {
+                       // Should not be NULL
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               }
+
+               // Use debug output handler
+               //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
+               $this->output(sprintf('INFO: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -263,7 +295,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
 
                // Use debug output handler
                //* NOISY-DEBUG: */ printf('[%s:%d]: Invoking this->output(%s,%d) ...' . PHP_EOL, __METHOD__, __LINE__, $message, intval($stripTags));
-               $this->output($message, $stripTags);
+               $this->output(sprintf('WARNING: %s', $message), $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
@@ -294,7 +326,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
        }
 
        /**
-        * Outputs a debug message whether to debug instance (should be set!) or
+        * Outputs a deprecated message whether to debug instance (should be set!) or
         * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
         * ApplicationEntryPoint::app_exit(), this would cause an endless loop.
         *
@@ -305,7 +337,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         * @throws      NullPointerException    If this->outputInstance is NULL
         * @todo        Remove $doPrint parameter
-        * @deprecated  Rewrite to "new" methods above
+        * @todo        When all old method invocations are fixed, renamed this do deprecatedMessage
         */
        public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false) {
                // Check parameter
@@ -318,8 +350,8 @@ class DebugMiddleware extends BaseMiddleware implements Registerable {
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
                }
 
-               // Invoke new version
-               $this->debugMessage($message, $doPrint, $stripTags);
+               // Invoke Inner method
+               $this->outputMessage(sprintf('DEPRECATED: %s', $message), $doPrint, $stripTags);
 
                // Trace message
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);