## trace.Traceable


Provides basic trace functionality for a process to subclass.


Usage

``` python
trace.Traceable(debug=DEFAULT_DEBUG)
```


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()](trace.Traceable.md#sim_tools.trace.Traceable.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__()](#__init__) | Initialise Traceable |
| [trace()](#trace) | Display a formatted trace of a simulated event. |

------------------------------------------------------------------------


#### \_\_init\_\_()


Initialise Traceable


Usage

``` python
__init__(debug=DEFAULT_DEBUG)
```


##### Parameters


`debug: bool | None = DEFAULT_DEBUG`    
show trace(True). do not show trace (False)


------------------------------------------------------------------------


#### trace()


Display a formatted trace of a simulated event.


Usage

``` python
trace(time, msg=None, process_id=None)
```


Implemented with the rich library Console() object.


##### Parameters


`time: float`  
The simulation time

`msg: str | None = None`  
Event message to display to user.

`process_id: str | None = None`  
Display an unique identifer for the trace message .
