function loggStuff() { loggHeader("A header"); loggThis("write a message"); loggThis("include call trace", null, true); loggThis("include an object", new \Exception("foo exception"), false); }
public function BuyProductfail() { try { throw new Exception("an order has failed"); // orders get wrong during the buy order } catch (EXCEPTION $e) { $ip = $_SERVER['REMOTE_ADDR']; $ipadress = array($_SERVER['REMOTE_ADDR']); sort($ipadress); $f = fopen("store.txt", "a+"); fwrite($f, "ip : "); fwrite($f, $ip); fwrite($f, loggthis("an order has failed", $e)); fwrite($f, "\n"); fwrite($f, loggThis("include call trace", true)); fwrite($f, "\n"); fwrite($f, loggThis("include an object", false, new Exception("foo exception"))); fwrite($f, date("D dS M,Y h:i a")); fwrite($f, "\n"); // write in info and session traces all that in fwrite($f, $e); fwrite($f, "\n"); fclose($f); } }