# log（ログ）

{% hint style="info" %}
Eagle の[ソフトウェアログ](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"
```

***

#### メソッド <a href="#z1a5y" id="z1a5y"></a>

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

ソフトウェアログにデバッグタイプの内容を記録する

* `obj` Object - 記録したい内容。`Object`、`String`、`Array` など様々な形式が使用できる。

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

***

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

ソフトウェアログに情報タイプの内容を記録する

* `obj` Object - 記録したい内容。`Object`、`String`、`Array` など様々な形式が使用できる。

***

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

ソフトウェアログに警告タイプの内容を記録する

* `obj` Object - 記録したい内容。`Object`、`String`、`Array` など様々な形式が使用できる。

***

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

ソフトウェアログにエラータイプの内容を記録する

* `obj` Object - 記録したい内容。`Object`、`String`、`Array` など様々な形式が使用できる。

```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/ja-jp/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.
