debug_toolbar.litestar.plugin

Debug toolbar plugin for Litestar.

Classes

DebugToolbarPlugin([config])

Litestar plugin for the debug toolbar.

class debug_toolbar.litestar.plugin.DebugToolbarPlugin(config=None)[source]

Litestar plugin for the debug toolbar.

This plugin automatically configures the debug toolbar middleware and registers API routes for the toolbar interface.

Example:

from litestar import Litestar
from debug_toolbar.litestar import DebugToolbarPlugin, LitestarDebugToolbarConfig

config = LitestarDebugToolbarConfig(
    enabled=True,
    exclude_paths=["/health", "/metrics"],
)

app = Litestar(
    route_handlers=[...],
    plugins=[DebugToolbarPlugin(config)],
)
__init__(config=None)[source]

Initialize the plugin.

Parameters:

config (LitestarDebugToolbarConfig | None) – Toolbar configuration. Uses defaults if not provided.

property config: LitestarDebugToolbarConfig

Get the plugin configuration.

property toolbar: DebugToolbar | None

Get the toolbar instance.

on_app_init(app_config)[source]

Configure the application with the debug toolbar.

Parameters:

app_config (AppConfig) – The application configuration.

Return type:

AppConfig

Returns:

The modified application configuration.