I'm starting work on a API call which I have no idea what the data structure is or where the data I'm interested in comes into play. I work through a VM so I don't currently have access to PRY. I looked to see what kind of logging we have in place but I didn't find anything that was as easy as pry for a direct look at my issue. I also didn't want to parse through all the noise of development.log
by simply using logger.info
This is what I came up with
class Log
def self.ger(message=nil)
@log ||= Logger.new("#{Rails.root}/log/ger.log")
if message.nil?
@log.debug("willy nilly")
else
@log.debug("Class: " + message.class.inspect)
@log.debug(message.inspect + "\n\n")
end
end
end
-
Add that file ☝️ to
models/
-
Put
Log.ger(thing_of_interest)
where ever you want -
Open up a new terminal window and
tail -f log/ger.log
-
Hopefully you'll see what you want to see.