Write errors to stderr master github/master
authorChristian Weiske <cweiske@cweiske.de>
Fri, 17 Apr 2020 12:03:55 +0000 (14:03 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 17 Apr 2020 12:03:55 +0000 (14:03 +0200)
src/phinde/Log.php

index cc8cf12..36a126b 100644 (file)
@@ -5,7 +5,7 @@ class Log
 {
     public static function error($msg)
     {
-        static::log($msg);
+        static::log($msg, STDERR);
     }
 
     public static function info($msg)
@@ -15,7 +15,7 @@ class Log
         }
     }
 
-    public static function log($msg)
+    public static function log($msg, $stream = STDOUT)
     {
         if (isset($GLOBALS['phinde']['logfile'])
             && $GLOBALS['phinde']['logfile'] != ''
@@ -25,7 +25,7 @@ class Log
                 $msg . "\n", FILE_APPEND
             );
         } else {
-            echo $msg . "\n";
+            fwrite($stream, $msg . "\n");
         }
     }
 }