From: Gary Weaver Date: 2012-10-18T07:26:20+09:00 Subject: Re: autolog: shortcut for set_trace_func to debug ruby via console output, etc. Ryan Davis wrote in post #1080212: > On Oct 17, 2012, at 11:35 , Gary Weaver wrote: > >> In Gemfile add: >> >> https://github.com/garysweaver/autolog > > How does this compare to stdlib's tracer? > > ## > # Start tracing > # > # === Example > # > # Tracer.on > # # code to trace here > # Tracer.off > # > # You can also pass a block: > # > # Tracer.on { > # # trace everything in this block > # } It is basically like an event-specific version of Tracer. autolog :methods autolog :c_calls autolog :c_returns autolog :c_calls_and_returns autolog :class_starts autolog :class_ends autolog :classes autolog :method_calls autolog :method_returns autolog :methods autolog :lines autolog :raises autolog :trace autolog :event :c_return autolog :events 'raise', 'c-call' autolog :events :raise, :c_call autolog :off Autolog.c_calls Autolog.c_returns Autolog.c_calls_and_returns Autolog.class_starts Autolog.class_ends Autolog.classes Autolog.method_calls Autolog.method_returns Autolog.methods Autolog.lines Autolog.raises Autolog.trace Autolog.event :c_return Autolog.events 'raise', 'c-call' Autolog.events :raise, :c_call Autolog.off Now takes blocks: autolog do puts "this is something" puts "this is something 2" end autolog :methods do # ... end autolog :c_calls_and_returns do # ... end autolog :lines do # ... end autolog :events, :line, :c_call do # ... end Can use in main, Object, or call methods on it. Could use some help making it better if anyone wants to help. -- Posted via http://www.ruby-forum.com/.