Warning

This documentation is for an unreleased version of MPF!

This is the developer documentation for MPF 0.51, 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.

LogMixin

class mpf.core.logging.LogMixin

Bases: object

Mixin class to add smart logging functionality to modules.

Methods & Attributes

The LogMixin has the following methods & attributes available. Note that methods & attributes inherited from the base class are not included here.

configure_logging(logger: str, console_level: str = 'basic', file_level: str = 'basic')

Configure logging.

Parameters:
  • logger – The string name of the logger to use.
  • console_level – The level of logging for the console. Valid options are “none”, “basic”, or “full”.
  • file_level – The level of logging for the console. Valid options are “none”, “basic”, or “full”.
debug_log(msg: str, *args, **kwargs) → None

Log a message at the debug level.

Note that whether this message shows up in the console or log file is controlled by the settings used with configure_logging().

error_log(msg: str, *args, context=None, **kwargs) → None

Log a message at the error level.

These messages will always be shown in the console and the log file.

ignorable_runtime_exception(msg: str) → None

Handle ignorable runtime exception.

During development or tests raise an exception for easier debugging. Log an error during production.

info_log(msg: str, *args, context=None, **kwargs) → None

Log a message at the info level.

Whether this message shows up in the console or log file is controlled by the settings used with configure_logging().

raise_config_error(msg, error_no, *, context=None)

Raise a ConfigFileError exception.

warning_log(msg: str, *args, context=None, **kwargs) → None

Log a message at the warning level.

These messages will always be shown in the console and the log file.