# Debug Plugin

## Window Plugin Debug <a href="#zqpdi" id="zqpdi"></a>

After opening the plugin, press the F12 key to open the DevTools debugging tool.

<figure><img src="/files/CeBx6FsLay5n0orPtjGx" alt=""><figcaption><p>DevTools</p></figcaption></figure>

The specific steps are as follows:

1. Open the plugin you want to debug in Eagle, and press the F12 key to open DevTools.
2. In DevTools, you can view the plugin's code and use breakpoints and debugging tools to debug the plugin's execution process.
3. You can also use other tools in DevTools to view information about the plugin's performance, memory usage, etc.

## Debug Thumbnail Plugin

The thumbnail plugin runs in the background, and the code is only executed when files are added or updated. If you want to debug the thumbnail function code, you can set the devTools property to true in the manifest.json file and set debugger breakpoints in the code, which can then be debugged using devTools.

## Debug Preview Plugin

Add and select the file format you want to develop in Eagle, open the plugin panel, click on the plugin you're developing, and a separate preview window will open. You can press `F12` to open `DevTools` for debugging.

{% hint style="info" %}
Learn more: If you are unsure how to use DevTools, you can refer to the following learning resources:

1. Google official documentation: <https://developers.google.com/web/tools/chrome-devtools>
2. MDN Web documentation: <https://developer.mozilla.org/zh-CN/docs/Tools>
3. W3Schools tutorial: <https://www.w3schools.com/js/js_debugging.asp>
   {% endhint %}

## Log System <a href="#pui04" id="pui04"></a>

{% hint style="warning" %}
Please note: The preview and thumbnail plugins currently do not support the log API.
{% endhint %}

A logging system is a tool used to record the running status of software, helping developers to locate and solve problems more quickly. The logging system records software error information, warning information, runtime information, etc., and can be used as a debugging tool. In a non-development environment, the logging system effectively helps developers identify the causes of problems and take measures to solve them.

Eagle Plugin API provides a [log functionality](/plugin-api/api/log.md) to record plugin runtime information. This way, developers can record the plugin's running, warnings, errors, and other information in Eagle's software logs. By using this feature, developers can view this information by only providing a debug report to the user. While developing plugins, the logging feature helps developers to quickly locate and solve problems.

```javascript
eagle.log.debug('debug message from plugin');
eagle.log.info('info message from plugin');
eagle.log.warn('warn message from plugin');
eagle.log.error('error message from plugin');

// [13:19:39.845] [debug] [plugin] "debug message from plugin"
// [13:19:39.845] [info] [plugin] "info message from plugin"
// [13:19:39.845] [warn] [plugin] "warn message from plugin"
// [13:19:39.845] [error] [plugin] "error message from plugin"
```

{% hint style="info" %}
Learn More: [Log - API Reference](/plugin-api/api/log.md)
{% endhint %}

{% hint style="info" %}
Click here to view Eagle's [software log](https://docs-cn.eagle.cool/article/92-how-do-i-get-the-error-log) acquisition method.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/get-started/debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
