Autolog: easily debug-like logging on the fly in your Rails app

If it helps anyone developing Rails apps or gems, I wrote a shortcut for
set_trace_func, so next time you want to just add a line before and
some function you are trying to debug you can have Ruby temporarily
every line, method, etc. executed. Also, it lets you define the format,
other loggers, etc. via a proc/lambda define, since you might not like
default format. Apologize for posting here if it wouldn’t help- maybe
are using a real debugger.


In Gemfile add:
gem ‘autolog’

Around some part of code add this before:
and this after:

Hope it helps someone who needs a quick tool periodically without all
time sink of profiling or setting a breakpoint and debugging in a slow

Gem changed a lot from yesterday. It’s a little more like Tracer now:

autolog v0.2.0 released. didn’t have autolog method on Object’s
which meant it wasn’t very helpful outside of main where I’d added it
specifically, and I wasn’t doing an ensure on the block execution to
it off if anything was raised in the block.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs