Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.1 KB

visual-debugger.md

File metadata and controls

38 lines (30 loc) · 1.1 KB

Visual debugger

In development, you can turn on tracing of the decision graph for a resource by implementing the #trace? callback so that it returns true:

class MyTracedResource < Webmachine::Resource
  def trace?
    true
  end

  # The rest of your callbacks...
end

Then enable the visual debugger resource by adding a route to your configuration:

Webmachine.application.routes do
  # This can be any path as long as it ends with :*
  add ['trace', :*], Webmachine::Trace::TraceResource
  # The rest of your routes...
end

Now when you visit your traced resource, a trace of the request process will be recorded in memory. Open your browser to /trace to list the recorded traces and inspect the result. The response from your traced resource will also include the X-Webmachine-Trace-Id that you can use to lookup the trace. It might look something like this:

preview calls at decision

Refer to examples/debugger.rb for an example of how to enable the debugger.