<commit_before>require 'librarian/support/abstract_method'

module Librarian
  module Helpers
    module Debug

      include Support::AbstractMethod

      abstract_method :root_module

    private

      def relative_path_to(path)
        root_module.project_relative_path_to(path)
      end

      def debug
        if root_module.ui
          root_module.ui.debug { "[Librarian] #{yield}" }
        end
      end

    end
  end
end<commit_msg>Show the file:line: in `method' when printing debug output.<commit_after>require 'librarian/support/abstract_method'

module Librarian
  module Helpers
    module Debug

      include Support::AbstractMethod

      abstract_method :root_module

    private

      def relative_path_to(path)
        root_module.project_relative_path_to(path)
      end

      def debug
        if root_module.ui
          loc = caller.find{|l| !(l =~ /in `debug'$/)}
          root_module.ui.debug { "[Librarian] #{yield} [#{loc}]" }
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.0796812749003984, 'fraction_numerical': 0.0, 'mean_word_length': 2.4775086505190314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7634725', 'n_tokens_mistral': 313, 'n_tokens_neox': 298, 'n_words': 71}