public function onResponseSent() { if (!$this->settings->hasSetting("debug_log") or !$this->environment->request()) { return; } $path = $this->environment->request()->path(); if (count($path) > 0 and strcasecmp($path[0], "debug") == 0) { return; } $log = $this->settings->setting("debug_log"); $handle = @fopen($log, "a"); if (!$handle) { Logging::logError("Could not write to log file: " . $log); return; } $trace = Logging::getTrace(); try { foreach ($trace as $d) { fwrite($handle, Util::toString($d)); } fclose($handle); } catch (Exception $e) { Logging::logError("Could not write to log file: " . $log); Logging::logException($e); } }
private function getErrorResponse($err, $details, $data = NULL) { if (Logging::isDebug()) { Logging::logDebug("RESPONSE error " . Util::toString($err) . " " . Util::toString($details) . " " . Util::toString($data)); return array("code" => $err[0], "error" => $err[1], "details" => $details, "data" => $data, "trace" => Logging::getTrace()); } return array("code" => $err[0], "error" => $err[1], "details" => $details, "data" => $data); }