Skip to content

usd_chunks

usd_chunks: interactive UI panels ("chunks") for OpenUSD, built from plain Python modules.

Importing the package checks that the OpenUSD bindings are importable, sets the usd_chunks logger's level (from USD_CHUNK_LOG_LEVEL), and checks the attrs version. It adds no console handler; entry points call configure_logging() for that.

configure_logging ⚓︎

configure_logging(level=logging.DEBUG)

Send usd_chunks log records to the console, unless the host already logs somewhere.

Called by the entry points, not on import. Idempotent. Skipped when the root logger has a handler: records propagate there, and a second handler would print each one twice.

Parameters:

Name Type Description Default
level int

The least severe record printed. A script Scene prints warnings and up.

DEBUG
Source code in usd_chunks/__init__.py
def configure_logging(level: int = logging.DEBUG) -> None:
    """Send ``usd_chunks`` log records to the console, unless the host already logs somewhere.

    Called by the entry points, not on import. Idempotent. Skipped when the root logger has a
    handler: records propagate there, and a second handler would print each one twice.

    Args:
        level: The least severe record printed. A script Scene prints warnings and up.
    """
    global _console_handler
    if _console_handler is not None or logging.getLogger().handlers:
        return
    _console_handler = logging.StreamHandler()
    _console_handler.setLevel(level)
    _console_handler.setFormatter(logging.Formatter(
        "%(levelname)s: %(asctime)s - %(name)s: %(message)s", datefmt="%y-%m-%d %H:%M"
    ))
    _logger.addHandler(_console_handler)