tracing

Tracing provides a single method call trace which is used in a number of ways to generated highly configurable nested tracing output from your program. Each trace key is defined by a symbolic keyword, which is enabled by including it in a comma-separated list in the TRACE environment variable.

INSTALL:

USAGE:

require 'tracing'

When trace is called with no arguments, it returns the Tracer singleton object. The API of this object is defined below. You probably don't need to use this.

If called with one argument, that should be a Symbol, which is the trace key. Nothing is printed, and the return value is true if this trace key is enabled.

Normal calls to trace take two or more arguments, and an optional block.

The first argument is a Symbol, which is the trace key.

The second and any subsequent arguments are either a String (or anything that can be *join*ed) or a Proc (or anything which can be called), which is evaluated and printed if the trace key is enabled.

If a block is passed, the nesting level is increased (if this key was enabled), the block is called, and trace returns its return value (restoring the nesting).

SPECIAL TRACE KEYS

Specific TRACE keys configure internal behaviour:

The debugger is chosen from ENV or the first to load of: byebug, pry. debugger, ruby-trace

TRACER API

The Tracer supports the following methods:

Contributing to tracing

Copyright © 2016 Clifford Heath. See LICENSE.txt for further details.