Tracer (xonsh.tracer)

Implements a xonsh tracer.

class xonsh.tracer.TracerAlias(threadable=True, **kwargs)[source]

Tool for tracing xonsh code as it runs.

build()[source]

Sub-classes should return constructed ArgumentParser

create_parser(func=None, has_args=False, allowed_params=None, **kwargs)

create root parser

property parser
class xonsh.tracer.TracerType(*args, **kwargs)[source]

Represents a xonsh tracer object, which keeps track of all tracing state. This is a singleton.

color_output(usecolor)[source]

Specify whether or not the tracer output should be colored.

off_files(_args, files: Iterable[str] = ('__file__'))[source]

removes selected files fom tracing.

Parameters
files

file paths to stop watching, use __file__ (default) to select the current file.

on_files(_args, files: Iterable[str] = ('__file__'))[source]

begins tracing selected files.

Parameters
_args

argv from alias parser

files

file paths to watch, use “__file__” (default) to select the current file.

start(filename)[source]

Starts tracing a file.

stop(filename)[source]

Stops tracing a file.

toggle_color(toggle: bool = False)[source]

output color management for tracer

Parameters
toggle

true/false, y/n, etc. to toggle color usage.

trace(frame, event, arg)[source]

Implements a line tracing function.

valid_events = frozenset({'call', 'line'})
xonsh.tracer.tracer_format_line(fname, lineno, line, color=True, lexer=None, formatter=None)[source]

Formats a trace line suitable for printing.