libretro.api.log

Types for allowing Cores to log messages.

See also

LogDriver

The protocol that uses these types to implement logging support in libretro.py.

libretro.drivers.log

libretro.py’s included LogDriver implementations.

Module Attributes

retro_log_printf_t

Log a message at the given severity level.

Classes

LogLevel

libretro's defined log severity levels.

retro_log_callback

Provides the Core with a logging function.

class LogLevel[source]

Bases: IntEnum

libretro’s defined log severity levels.

Corresponds to retro_log_level in libretro.h.

DEBUG = 0
INFO = 1
WARNING = 2
ERROR = 3
property logging_level

Returns the equivalent logging level.

>>> import logging
>>> from libretro.api import LogLevel
>>> LogLevel.WARNING.logging_level == logging.WARN
True
__new__(value)
classmethod value in self

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod self[name]

Return the member matching name.

__init__()
classmethod iter(self)

Return members in definition order.

classmethod len(self)

Return the number of members (no aliases)

class retro_log_callback[source]

Bases: Structure

Provides the Core with a logging function.

Corresponds to retro_log_callback in libretro.h.

log

A printf-style logging function. Set by the frontend.

See also

LogDriver.log

The suggested entry point for this callback in libretro.py.

__deepcopy__(_)[source]

Return a copy of this object. Intended for use with copy.deepcopy().

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
retro_log_printf_t

Log a message at the given severity level.

Registered by the frontend and called by the core to write a printf-style message to the frontend’s log.

Parameters:
  • level – A LogLevel that classifies the severity of the message.

  • fmt – The format string to log, as a bytes-like object.

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 the result as the format string.

Corresponds to retro_log_printf_t in libretro.h.

See also

LogDriver.log

The suggested entry point for this callback in libretro.py.

retro_log_level

alias of c_int