This documentation is for an unreleased version of MPF!
This is the developer documentation for MPF 0.54, which is the “dev” (next) release of MPF that is a work-in-progress. Use the “Read the Docs” link in the lower left corner to view the developer docs for the version of MPF you’re using.
Writes switch events, regular events, and player variables to an audit log file.
Accessing the auditor in code
There is only one instance of the auditor in MPF, and it’s accessible via
Methods & Attributes
The auditor has the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.
audit(audit_class, event, **kwargs)¶
Log an auditable event.
- audit_class – A string of the section we want this event to be logged to.
- event – A string name of the event we’re auditing.
- **kwargs – Not used, but included since some of the audit events might include random kwargs.
Record this event in the audit log.
- eventname – The string name of the event.
- **kwargs – not used, but included since some types of events include kwargs.
Write player data to the audit log.
Typically this is only called at the end of a game.
Parameters: **kwargs – not used, but included since some types of events include kwargs.
audit_shot(name, profile, state)¶
Record shot hit.
Record switch change.
Disable the auditor.
Enable the auditor.
This method lets you enable the auditor so it only records things when you want it to. Typically this is called at the beginning of a game.
Parameters: **kwargs – No function here. They just exist to allow this method to be registered as a handler for events that might contain keyword arguments.
Attribute that’s viewed by other core components to let them know they should send auditing events. Set this via the enable() and disable() methods.