Add cli tool to unsubscribe from a topic
[phinde.git] / src / phinde / Log.php
index 2369a2bc86b8dc0f261dfb921b0ccaded38733c8..cc8cf1224e053ea03da334eb156d9e87bfd40c99 100644 (file)
@@ -17,7 +17,16 @@ class Log
 
     public static function log($msg)
     {
-        echo $msg . "\n";
+        if (isset($GLOBALS['phinde']['logfile'])
+            && $GLOBALS['phinde']['logfile'] != ''
+        ) {
+            file_put_contents(
+                $GLOBALS['phinde']['logfile'],
+                $msg . "\n", FILE_APPEND
+            );
+        } else {
+            echo $msg . "\n";
+        }
     }
 }
 ?>