TraceCollector
- class shell_logger.trace_collector.TraceCollector(**kwargs)[source]
Bases:
objectTrace a command run in the underlying shell.
Provides an interface for the
ShellLoggerto run commands with a certain trace (e.g.,straceorltrace).Initialize the
TraceCollectorobject.Set up the output file where the trace information will be written.
- command(command)[source]
Get the command to be run in the underlying shell.
Return a command that runs a trace on
command. E.g.,ls -lmight get translated tostrace -f -c -e 'open' -- ls -l.- Parameters:
command (
str) – The command to be traced.
- static subclass(trace_subclass)[source]
Mark a class as being a supported trace collector.
This is a class decorator that adds to a list of supported
TraceCollectorclasses for thetrace_collector()factory method.
- subclasses = [<class 'shell_logger.trace_collector.STraceCollector'>, <class 'shell_logger.trace_collector.LTraceCollector'>]
- abstract property trace_args: str
Get the trace command.
The trace command and the arguments you pass to it, but not the command you’re tracing. E.g., return strace -f -c -e “open”.
- trace_name = 'undefined'
- shell_logger.trace_collector.trace_collector()[source]
Generate trace collectors.
A factory method that returns any subclass of
TraceCollectorthat has the@TraceCollector.subclassdecorator applied to it.- Parameters:
**kwargs – Any supported arguments of the
TraceCollectorsubclass.- Return type:
- Returns:
A single instance of a
TraceCollectorsubclass.
STraceCollector
- class shell_logger.trace_collector.STraceCollector(**kwargs)[source]
Bases:
TraceCollectorRun
straceon commands.An interface between
ShellLoggerand thestracecommand.Initialize the
STraceCollectorinstance.- trace_name = 'strace'
LTraceCollector
- class shell_logger.trace_collector.LTraceCollector(**kwargs)[source]
Bases:
TraceCollectorRun
ltraceon commands.An interface between
ShellLoggerand theltracecommand.Initialize the
LTraceCollectorinstance.- property trace_args
Wraps a command in a
ltracecommand.
- trace_name = 'ltrace'