Search for wandering code in ruby ​​code

We have a pretty big rails application, and I started this output in our unicorn.log:

#: 0xc644248> #: 0xc644248> #: 0xc4f06e4> #: 0xc4f06e4> #: 0xca481b4> #: 0xca481b4> #: 0xc53f604> #: 0xc53f604> #: 0xcd7a60c> #x2> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x> 0x 0xc69fd00> #: 0xc69fd00> #: 0xc560ae8> #: 0xc560ae8>

It seems to me that there is probably some kind of random method Kernel.puts, but I searched for the clock and cannot find it.

Anyone have tips for tracking something like this?

+3
source share
4 answers

Have you checked display? This is another method that prints material.

+2
source

. ( ).

module Kernel
  def puts (s)
    raise "puts called, check the backtrace for the source" if s =~ /#:[a-z0-9]>*/
  end
end

, , #inspect.

+8

Kernel.puts, :

find -iname "*.rb" | xargs grep -iR 'Kernel.puts'

, ( ), , , , .

+1

, , , , , . grep :

grep -rn 'puts'.

, , , . , . .

0

Source: https://habr.com/ru/post/1788997/


All Articles