# log

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

```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"
```

***

#### Methods <a href="#z1a5y" id="z1a5y"></a>

## debug(obj) <a href="#haugb" id="haugb"></a>

Log debug-type content to the software log

* `obj` Object - The content to be recorded, can be `Object`, `String`, `Array`, and other formats

```javascript
eagle.log.debug(obj);
eagle.log.debug(array);
eagle.log.debug('error message from plugin');
```

***

## info(obj) <a href="#qxf3f" id="qxf3f"></a>

Log info-type content to the software log

* `obj` Object - The content to be recorded, can be `Object`, `String`, `Array`, and other formats

***

## warn(obj) <a href="#ctpju" id="ctpju"></a>

Log warn-type content to the software log

* `obj` Object - The content to be recorded, can be `Object`, `String`, `Array`, and other formats

***

## error(obj) <a href="#mo6j1" id="mo6j1"></a>

Log error-type content to the software log

* `obj` Object - The content to be recorded, can be `Object`, `String`, `Array`, and other formats

```javascript
try {
    let a = {};
    a.b.c = 'test';
}
catch (err) {
    eagle.log.error('error message from plugin');
    eagle.log.error(err.stack || err);
}

// [13:23:24.191] [error] [plugin] "error message from plugin"
// [13:23:24.191] [error] [plugin] "TypeError: Cannot set properties of undefined (setting 'c')\n    at <anonymous>:3:11"
```

***


---

# 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/api/log.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.
