Do not use STDOUT and STDERR constants
[phinde.git] / src / phinde / Log.php
index cc8cf1224e053ea03da334eb156d9e87bfd40c99..7ae0d82ebc70324e2bd3b272b514ecea8619a3f8 100644 (file)
@@ -5,7 +5,7 @@ class Log
 {
     public static function error($msg)
     {
-        static::log($msg);
+        static::log($msg, 'php://stderr');
     }
 
     public static function info($msg)
@@ -15,7 +15,7 @@ class Log
         }
     }
 
-    public static function log($msg)
+    public static function log($msg, $stream = 'php://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");
         }
     }
 }