# Gadget Code IDE Log (part of Drone Monitor)

We have an abstract logging system in gadget-drone [DtpLog](../src/lib/log.ts), with an abstract log transport [DtpLogTransport](../src/lib/log-transport.ts).

In the gadget-code:ide (the HTML5 ReactJS client that runs in the browser) we have a Chat Session view. In that view, there is a Log component. The intent is for gadget-drone to emit Socket.IO messages for log writes into the active ChatSession that holds the session lock on that drone.

While a ChatSession holds a session lock on a drone, the drone's log messages should shuttle to the IDE by way of gadget-code:web like it's other messages do. The IDE should then display the Log messages in the Log panel.

The User should be able to expand the Log to occupy the entire Content Area of the Chat Session view, and collapse it back to it's normal size at the bottom of the view.

A drone's Log is also available in the Drone Monitor view of [Drone Manager](./drone-manager.md).

## Auto-Scroll Behaviors

The Log should always initialize scrolled to the bottom. The log should auto-scroll to the bottom as messages are received as long as the User hasn't scrolled up. If the user has scrolled up, new messages are appended to the end of the log but its scroll position does not change. This is true for the normal size log view and also the full-sized log when expanded. The log view should simply behave as expected even while an agent is actively processing a work order and emitting events.

## User Interaction

Log events are not selectable. The user can't open a log event and see more. Log events display their data in the log.

The log in the IDE is a convenience feature. The logs are also being written to disk on the drone hosts. The User can always reference those logs on the host and has access to the host. So we don't need to keep more than 200 log entries in memory in the IDE.
