Function d__

Displays formatted result and inputs for the current thread using a given format.

Optionally calls allow, before, and after functions with the data.

allow, before, and after will receive a parameter data with the allowed inputs. The following meta values will also be available:

  • meta__: List of meta keys including the name key.
  • thread_id__: ID of the thread being executed.
  • allow_input_count__: Total number of inputs that are allowed.
  • input_count__: Total number of inputs being captured.
  • allow__: If false it was allowed. Use this for the after callback.
  • output__: Text passed to before without new_line.
  • name: The value parameter.
d__(x);
d__(c__(x) + c__(y));

d__(c__(x) + c__(y), { name: "output" });

d__(c__(x) + c__(y), { allow: data => data.input_count__ === 2 });
d__(c__(x) + c__(y), { allow: data => data.i0 === 10.0 });
d__(c__(x, { allow: (index, name, value) => value > 10 }) + c__(y),
{ allow: data => data.allow_input_count__ === 2 });

d__([c__(x) for x in ['10', '20']], { before: data => '10' in data.output__ });

d__([c__(x) for x in ['1', '2']], {
allow: data => data.allow_input_count__ === 2,
after: data => call_after(data) if (data.allow__) else ""
});
  • Parameters

    • value: any

      The result to trace.

    • params: {
          after?: EventCallback;
          allow?: boolean | AllowCallback;
          before?: EventCallback;
          format?: Format;
          inputs?: Record<string, any>;
          name?: string;
      } = {}

      The named parameters.

      • Optionalafter?: EventCallback

        A function to call after displaying the output. after is always called even if not allowed.

      • Optionalallow?: boolean | AllowCallback

        A function to call to allow tracing. If it returns false, tracing is skipped but after is still called. If it returns a non-boolean value, it will display the allow result instead of the value.

      • Optionalbefore?: EventCallback

        A function to call before displaying the output. If it returns false, tracing is skipped.

      • Optionalformat?: Format

        Alternative output format.

      • Optionalinputs?: Record<string, any>

        Dictionary of additional inputs.

      • Optionalname?: string

        The name of the function being traced.

    Returns any

    The traced value.