Tracking down stray console messages in Ruby
While working on Planypus we recently ran into an issue where something was outputting strange messages to the console. Luckily, Anton Mostovoy figured out a clever dynamic Ruby hack to track who was outputting the message:
$stdout.instance_eval do
alias :inner_puts :write
def write (str)
inner_puts %Q!#{str} was said by #{caller.join("\n")}!
end
end
Like Magic!










No Comments Yet