_EventBase
is the base class of VizCounter
and VizObject
. It should never be used directly.
In practice, you can inherit from VizCounter
or VizObject
class and build your own class so it will be much easier to track the data in your class. Remember you need to do __init__
function of the base class! If your class has a lot of attributes and they are frequently being written to, it is wise to turn off trigger_on_change
class MyClass(VizObject):
def __init__(self, tracer):
super().__init__(tracer, "my name", trigger_on_change=False)
You can manually do log by
obj = MyClass(tracer)
obj.log()
or you can decorate your class method with triggerlog
to trigger log on function call
class MyClass(VizObject):
@VizObject.triggerlog
def log_on_this_function():
#function