Skip to content

Debugging

By default, console debug messages are not shown. To enable them you have to enable Verbose mode in the console settings.

Console settings

When you enable Verbose mode, you will see debug messages in the console sent via console.debug() calls.

obsidian-dev-utils uses debug library to enable conditional logging.

By default, none of the debug messages are shown. You have to enable the debug namespace explicitly.

To see debug messages for your plugin foo-bar, you have to enable them by running the corresponding command in the console:

window.DEBUG.enable('foo-bar'); // show all debug messages from the `foo-bar` plugin
window.DEBUG.enable('foo-bar:obsidian-dev-utils:*'); // show all debug messages from the `obsidian-dev-utils` library within the `foo-bar` plugin
window.DEBUG.enable('foo-bar:*'); // show all debug messages from the `foo-bar` plugin and its submodules
window.DEBUG.enable('*:obsidian-dev-utils:*'); // show all debug messages for the `obsidian-dev-utils` library within any plugin
window.DEBUG.enable('*'); // show all debug messages

See full documentation of window.DEBUG.

In order to write your debug messages from your plugin, use:

consoleDebugComponent.debug('foo', 'bar', 'baz');

You can use Advanced Debug Mode plugin to configure debug namespaces via Settings UI.