houdini_logging_tools.adapters

houdini_logging_tools.adapters.loggeradapter module

Custom logging adapter for Houdini.

class houdini_logging_tools.adapters.loggeradapter.HoudiniLoggerAdapter(*args: Any, **kwargs: Any)[source]

Bases: LoggerAdapter

Custom LoggerAdapter for Houdini.

This adapter allows automated addition of node paths and log display in dialogs, status bar, etc. Also allows for automated notification.

Parameters:
  • base_logger – The base package logger.

  • node – Optional node for prefixing messages with the path.

  • dialog – Whether to always use the dialog option.

  • status_bar – Whether to always use the status bar option.

  • extra – Extra args to use to generate log messages.

classmethod from_name(name: str, node: hou.Node = None, *, dialog: bool = False, status_bar: bool = False, extra: dict | None = None) HoudiniLoggerAdapter[source]

Create a new HoudiniLoggerAdapter from a name.

This is a convenience function around the following code:

>>> base_log = logging.getLogger(name)
>>> logger = HoudiniLoggerAdapter(base_log)
Parameters:
  • name – The name of the logger to use.

  • node – Optional node for prefixing messages with the path.

  • dialog – Whether to always use the dialog option.

  • status_bar – Whether to always use the status bar option.

  • extra – Extra args to use to generate log messages.

Returns:

An adapter wrapping a logger of the passed name.

property dialog: bool

Whether the dialog will be displayed.

property node: hou.Node | None

A node the logger is associated with.

property status_bar: bool

Whether the message will be logged to the status bar.

process(msg: str, kwargs: Any) tuple[str, Any][source]

Override function to handle custom logic.

This will possibly insert a node path or to display a dialog with the log message before being passed to regular logging output.

Parameters:
  • msg – The log message.

  • kwargs – kwargs dict.

Returns:

The message and updated kwargs.