module RailsCallbackLog
Constants
- FILTER
Filtering is very expensive. It makes my test suite more than 50% slower. So, it's off by default.
Public Class Methods
gem_version()
click to toggle source
# File lib/rails_callback_log/version.rb, line 4 def self.gem_version ::Gem::Version.new('0.3.1') end
log(msg)
click to toggle source
# File lib/rails-callback_log.rb, line 20 def log(msg) if !FILTER || caller.any? { |line| matches_filter?(line) } logger.debug(format("Callback: %s", msg)) end end
logger()
click to toggle source
# File lib/rails-callback_log.rb, line 12 def logger ::Rails.logger || ::Logger.new(STDOUT) end
matches_filter?(str)
click to toggle source
# File lib/rails-callback_log.rb, line 16 def matches_filter?(str) source_location_filters.any? { |f| str.start_with?(f) } end
Private Class Methods
source_location_filters()
click to toggle source
# File lib/rails-callback_log.rb, line 28 def source_location_filters @@filters ||= %w(app lib).map { |dir| (::Rails.root + dir).to_s } end