/**
  * log Errors
  *
  * @author Fernando Ontiveros Lira <*****@*****.**>
  * @access public
  * @param db_error $obj
  * @param string $errorLevel
  * @return void
  */
 function logError($obj, $errorLevel = null)
 {
     global $_SESSION;
     global $_SERVER;
     if (is_null($errorLevel)) {
         if (isset($this->errorLevel)) {
             $errorLevel = $this->errorLevel;
         } else {
             $errorLevel = DB_ERROR_SHOWALL_AND_STOP;
             //for fatal errors the default is 3, show detailed and die.
         }
     }
     if ($errorLevel == DB_ERROR_SHOW_AND_STOP || $errorLevel == DB_ERROR_SHOW_AND_CONTINUE || $errorLevel == DB_ERROR_SHOWALL_AND_STOP || $errorLevel == DB_ERROR_SHOWALL_AND_CONTINUE) {
         print "<table border=1 style='font-family:Arial' cellspacing=1 cellpadding = 0 width=400 class= 'tableError' >";
         print "<tr><td><b>" . $obj->code . ' ' . $obj->message . "</b></td></tr>";
         if ($errorLevel == DB_ERROR_SHOWALL_AND_STOP || $errorLevel == DB_ERROR_SHOWALL_AND_CONTINUE) {
             print "<tr><td>" . $obj->userinfo . "</td></tr>";
         }
         print "</table>";
     }
     if (defined('DB_ERROR_BACKTRACE') && DB_ERROR_BACKTRACE) {
         print "<table border = 1 width=400 class= 'sendMsgRojo'><tr><td><textarea rows='12' cols='180' style='width:100%;font-family:courier;white-space:pre-line;overflow:auto;border:none;'>";
         print htmlentities(DBConnection::traceError());
         print "</textarea></td></tr></table>";
     }
     //G::setErrorHandler ( );
     G::customErrorLog('DB_Error', $obj->code . ' ' . $obj->message . '-' . $obj->userinfo, '', '');
     if ($errorLevel == DB_ERROR_SHOW_AND_STOP || $errorLevel == DB_ERROR_SHOWALL_AND_STOP) {
         die;
         //stop
     }
 }