Exemple #1
0
 /**
  * static method used to log an error and optionally show it also
  * @param string $message the error message to show
  * @param bool $show whether or not to also show the error on screen
  * @param int $http_code the HTTP status code to respond with
  */
 static function log($message, $show = false, $http_code = 500)
 {
     $maverick = \maverick\maverick::getInstance();
     //$caller = debug_backtrace();
     if ($maverick->get_config('config.error_detail')) {
         $message .= error::generate_call_trace();
     }
     if ($maverick->get_config('config.log_errors')) {
         $log_date = date("y-m-d");
         error_log("\n\n{$message}", 3, MAVERICK_LOGSDIR . "error-{$log_date}.log");
     }
     if ($show) {
         error::show(nl2br($message), $http_code);
     }
 }