module ChefCompat::Monkeypatches::Log

Public Instance Methods

caller_location() click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/log.rb, line 6
def caller_location
  # Pick the first caller that is *not* part of the Chef gem, that's the
  # thing the user wrote.
  @compat_resource_filter_paths ||=
    Gem.loaded_specs['chef'].require_paths.map { |p| File.join(Gem.loaded_specs['chef'].full_gem_path, p) } +
    Gem.loaded_specs['compat_resource'].require_paths.map { |p| File.join(Gem.loaded_specs['compat_resource'].full_gem_path, p) }

  caller.select { |c| !@compat_resource_filter_paths.any? { |path| c.start_with?(path) } }.first
end