Module: Tracee::Extensions::BetterErrors::Middleware

Extended by:
ActiveSupport::Concern
Defined in:
lib/tracee/ext/better_errors.rb

Instance Method Summary collapse

Instance Method Details

#log_exception_with_decorateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tracee/ext/better_errors.rb', line 11

def log_exception_with_decorate
  return unless logger = ::BetterErrors.logger

  message = "\n#{@error_page.exception.class} - #{@error_page.exception.message}:"

  logger.fatal message
  
  frames = @error_page.backtrace_frames # original definition
  frames = frames.map(&:to_s).reject {|line| line =~ IGNORE_RE}
  frames = Stack::BaseDecorator.(frames)
  frames.each do |frame|
    if frame =~ /[-\w]+ \(\d+\.[\w\.]+\) /
      logger.debug "  #{frame}"
    else
      logger.fatal "  #{frame}"
    end
  end
end