trace.Traceable
Provides basic trace functionality for a process to subclass.
Usage
trace.Traceable()Abstract base class Traceable
Subclasses must call
super().__init__(debug=True) in their init() method to initialise trace.
Subclasses inherit the following methods:
trace() - use this function print out a traceable event
_trace_config(): use this function to return a dict containing the trace configuration for the class. Subclasses should override it to implement custom formatting.
Notes
This class provides the same functionality as the function trace() in an object orientated framework. It in theory means cleaner code as the call to trace requires less parameters. However, it must be setup correctly.
Methods
| Name | Description |
|---|---|
| __init__() | Initialise Traceable |
| trace() | Display a formatted trace of a simulated event. |
__init__()
Initialise Traceable
Usage
__init__(debug=DEFAULT_DEBUG)Parameters
debug: Optional[bool] = DEFAULT_DEBUG- show trace(True). do not show trace (False)
trace()
Display a formatted trace of a simulated event.
Usage
trace(time, msg=None, process_id=None)Implemented with the rich library Console() object.
Parameters
time: float-
The simulation time
msg: Optional[str] = None-
Event message to display to user.
process_id: Optional[str] = None- Display an unique identifer for the trace message .