app/controllers/application_controller.rb
def log_error( output_message, verbose_trace = true )
    if $!.nil?                                      # When there's no exception, just use the INFO level:
      msg = "[W!]-- #{output_message}"
      puts( msg ) if DEBUG_VERBOSE_ON_CONSOLE       # (When no logging facility is enabled, this flag will generate an output on console)
      logger.warn( msg )
    else
      msg = "[E!]-- ERROR INTERCEPTED: #{output_message}"
      error_description = $!
      error_trace = $@.join("\r\n")
      user = current_user()
      user = user ? user.get_full_name : '(user not logged in yet)'

      if DEBUG_VERBOSE_ON_CONSOLE
        puts( msg )
        puts( error_description )
      end
      logger.error( msg )
      logger.error( error_description )
                                                    # Send a message to the developers anyway:
      begin
        AgexMailer.exception_mail( user, error_description, error_trace ).deliver
        logger.info("[*I*]- error report e-mail allegedly sent.")
      rescue
        logger.warn( '[W!]-- Unable to send out error report e-mail message, Mailer not responding or not configured properly yet.' )
      end
                                                    # If the verbose trace is enabled, log it:
      if verbose_trace
        puts( error_trace ) if DEBUG_VERBOSE_ON_CONSOLE
        logger.error( error_trace )
      end
    end
  end
# Just logs the specified output message using either WARN or ERROR level logging,
# with no subsequent redirection being made.
#
# When an exception has been intercepted and the variable $! has been set,
# the level will be set to ERROR (defaults to WARN).
#
Just logs the specified output message using either WARN or ERROR level logging,
with no subsequent redirection being made.

When an exception has been intercepted and the variable $. has been set,
the level will be set to ERROR (defaults to WARN).
Just logs the specified output message using either WARN or ERROR level logging with no subsequent redirection being made . When an exception has been intercepted and the variable $ . has been set the level will be set to ERROR ( defaults to WARN ) .
def log_error( output_message, verbose_trace = true )
    if $!.nil?                                      
      msg = "[W!]-- #{output_message}"
      puts( msg ) if DEBUG_VERBOSE_ON_CONSOLE       
      logger.warn( msg )
    else
      msg = "[E!]-- ERROR INTERCEPTED: #{output_message}"
      error_description = $!
      error_trace = $@.join("\r\n")
      user = current_user()
      user = user ? user.get_full_name : '(user not logged in yet)'
      if DEBUG_VERBOSE_ON_CONSOLE
        puts( msg )
        puts( error_description )
      end
      logger.error( msg )
      logger.error( error_description )
      begin
        AgexMailer.exception_mail( user, error_description, error_trace ).deliver
        logger.info("[*I*]- error report e-mail allegedly sent.")
      rescue
        logger.warn( '[W!]-- Unable to send out error report e-mail message, Mailer not responding or not configured properly yet.' )
      end
      if verbose_trace
        puts( error_trace ) if DEBUG_VERBOSE_ON_CONSOLE
        logger.error( error_trace )
      end
    end
  end
def log_error ( output_message , verbose_trace = true ) if $! . nil? msg = "[W!]-- #{output_message}" puts ( msg ) if DEBUG_VERBOSE_ON_CONSOLE logger . warn ( msg ) else msg = "[E!]-- ERROR INTERCEPTED: #{output_message}" error_description = $! error_trace = $@ . join ( "\r\n" ) user = current_user ( ) user = user ? user . get_full_name : '(user not logged in yet)' if DEBUG_VERBOSE_ON_CONSOLE puts ( msg ) puts ( error_description ) end logger . error ( msg ) logger . error ( error_description ) begin AgexMailer . exception_mail ( user , error_description , error_trace ) . deliver logger . info ( "[*I*]- error report e-mail allegedly sent." ) rescue logger . warn ( '[W!]-- Unable to send out error report e-mail message, Mailer not responding or not configured properly yet.' ) end if verbose_trace puts ( error_trace ) if DEBUG_VERBOSE_ON_CONSOLE logger . error ( error_trace ) end end end
Just logs the specified output message using either WARN or ERROR level logging,
with no subsequent redirection being made.
Just logs the specified output message using either WARN or ERROR level logging with no subsequent redirection being made .
# When there's no exception, just use the INFO level: # (When no logging facility is enabled, this flag will generate an output on console) # Send a message to the developers anyway: # If the verbose trace is enabled, log it:
output_message
verbose_trace