> For the complete documentation index, see [llms.txt](https://tweprogrammer.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tweprogrammer.twelite.info/operation/logging.md).

# ターミナルのログ

ターミナル接続中の入出力をログに残すことができます。サポートを受ける際などに、一連の操作を記録する目的で使用します。

### 制限事項

{% hint style="warning" %}

* 長期間の記録などには想定しておりません。
* 複数のログを同時に取得したい場合は、TWE-Programmer.exe を別のディレクトリにインストールしてください。
  {% endhint %}

### 使用方法

ターミナル接続前に \[ターミナルログを保存] をチェックしてください。

また、ログファイル (twelog.log, TWE-Programmer.exe と同じディレクトリ) は追加モードで記録されます。必要に応じてファイルを削除してからログ保存を開始してください。

ターミナル切断時に、notepad.exe によりログファイルを開きます。

### 入出力のルール

TWELITE への入出力を一つのファイルに記録します。

{% hint style="warning" %}
入出力のタイミング次第では、入力出力の記録が前後する場合があります。
{% endhint %}

#### TWELITEからの出力

| 文字列           | 解説                                                         |
| ------------- | ---------------------------------------------------------- |
| 表示可能なASCII文字列 | 0x20-0x7E, CR, LF (ただし \ バックスラッシュ 0x5c は後述)文字列はそのまま記録されます。 |
| 0x5C (\\)     | \\\ バックスラッシュ２つに変換されます                                      |
| それ以外          | \xy : xy は 0-9A-F のコードの１６進数が表示されます。                        |

#### TWELITE への入力

出力と区別するため、以下のエスケープシーケンスを入力の開始と終了に挿入します。

| 挿入場所 | シーケンス    |
| ---- | -------- |
| 入力開始 | `ESC[7m` |
| 入力終了 | `ESC[0m` |

上記エスケープシーケンスは ANSI ターミナルの反転表示にあたります。対応する端末で表示(Linuxなどで less -r twelog.log)すれば、可読性が良くなります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://tweprogrammer.twelite.info/operation/logging.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
