libretro.drivers.log.unformatted

A log driver that forwards core messages to Python’s logging module.

See also

libretro.api.log

Defines the log callback structure this driver implements.

Classes

UnformattedLogDriver

A LogDriver that forwards core log messages to a Python Logger.

class UnformattedLogDriver[source]

Bases: LogDriver

A LogDriver that forwards core log messages to a Python Logger.

All received messages are also stored in records for later inspection.

__init__(logger=None)[source]
Parameters:

logger (Logger | None) – An existing Logger to forward messages to. If None, a default logger named "libretro" is created that writes to sys.stderr at DEBUG level.

property records

All log records received from the core, in the order they were emitted.

classmethod __new__(*args, **kwargs)
log(level, fmt)[source]

Emit a log message from the core.

Corresponds to retro_log_printf_t.

Warning

retro_log_printf_t normally has printf-style variadic arguments, but ctypes doesn’t currently support variadic callbacks.

As a workaround, your Core can format log messages with sprintf or similar, then pass it as the format string.

Parameters:
  • level (LogLevel) – The severity of the message.

  • fmt (bytes) – The message as a null-terminated byte string.

See also

retro_log_callback.log

The function pointer field in the callback struct that this method implements.

Return type:

None