Module: Tracee

Defined in:
lib/tracee/preprocessors/quiet_assets.rb,
lib/tracee.rb,
lib/tracee/stack.rb,
lib/tracee/logger.rb,
lib/tracee/stream.rb,
lib/tracee/version.rb,
lib/tracee/benchmarkable.rb,
lib/tracee/ext/exception.rb,
lib/tracee/ext/better_errors.rb,
lib/tracee/ext/active_support.rb,
lib/tracee/preprocessors/base.rb,
lib/tracee/stack/base_decorator.rb,
lib/tracee/preprocessors/formatter.rb

Overview

quiet_assets gem works only on thread-safe environment or on multithreaded one with only few assets. Known issue: github.com/evrone/quiet_assets/issues/40 I’d fix it so that it would always reset log_level to that of Rails.application.config.log_level But such an approach will not allow to change log_level within runtime.

Tracee deals with it in pretty straightforward manner. It just ignores whatever we do not care about.

Defined Under Namespace

Modules: Benchmarkable, Extensions, Preprocessors, Stack Classes: Benchmark, IndifferentStream, Logger, Stream

Constant Summary collapse

CALLER_RE =
%r{^(?<path>.*?(?<file>[^/\\]+?))#{ # ( path ( file ) ) 
}:(?<line>\d+)(?::in #{ # :( line )[ :in
}`(?<is_block>block (?:\((?<block_level>\d+) levels\) )?in )?(?<method>.+?)'#{ # `( [ block in ] closure )' ]
})?$}
IGNORE_RE =
%r{/irb(/|\.rb$)#{ # irb internals
}|^[\w\-]+ \([\d\.]+\) #{ # rails-formatted gem paths
}|lib/active_support/dependencies.rb$#{ # everywhere-proxy
}|^-e$#{ # ruby -e oneliner
}|^(script|bin)/#{ # other common entry points
}|/gems/bundler-\d|ruby-\d.\d.\d(@[^/]+)?/bin/#{ # bundle console
}|bin/rails$|lib/rails/commands(/|\.rb$)#{ # rails console
}|lib/spring/#{ # spring middleware
}|/rubygems/core_ext/kernel_require.rb#{ # `require' override
}}
VERSION =
'1.0.20'

Class Method Summary collapse

Class Method Details

.decorate_active_support_stackObject



105
106
107
# File 'lib/tracee.rb', line 105

def decorate_active_support_stack
  ActiveSupport::BacktraceCleaner.prepend Tracee::Extensions::ActiveSupport::BacktraceCleaner
end

.decorate_better_errors_stack(from_decorate_everywhere = false) ⇒ Object



95
96
97
98
99
100
101
102
103
# File 'lib/tracee.rb', line 95

def decorate_better_errors_stack(from_decorate_everywhere=false)
  if defined? BetterErrors
    BetterErrors::Middleware.class_eval do
      include Tracee::Extensions::BetterErrors::Middleware
    end
  elsif !from_decorate_everywhere
    warn "Tracee.decorate_better_errors_stack was ignored, because BetterErrors hadn't been defined."
  end
end

.decorate_exceptions_stackObject



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/tracee.rb', line 83

def decorate_exceptions_stack
  Exception.trace_decorator = Stack::BaseDecorator
  
  # These would extremely slowdown or stop runtime
  [SystemStackError, NoMemoryError, NameError, defined?(IRB::Abort) && IRB::Abort].compact.each do |klass|
    klass.trace_decorator = nil
  end
  
  # But this NameError's subclass would not
  NoMethodError.trace_decorator = Exception.trace_decorator
end

.decorate_stack_everywhereObject



109
110
111
112
113
# File 'lib/tracee.rb', line 109

def decorate_stack_everywhere
  decorate_exceptions_stack
  decorate_better_errors_stack(true)
  decorate_active_support_stack
end