33 lines
2.0 KiB
Markdown
33 lines
2.0 KiB
Markdown
# Gadget Code: GadgetLogTransportSocket
|
|
|
|
We recently finished a large refactor of GadgetLog into the @gadget/api package, and all components are now consumers of this one unified logging interface. [GadgetLog](../packages/api/src/lib/log.ts) makes use of [GadgetLogTransport](../packages/api/src/lib/log-transport.ts) to provide an abstract log transport. The logging system is working as intended. Console logging works as expected. File logging works as expected.
|
|
|
|
We are now going to implement `GadgetLogTransportSocket`, which will transmit a Socket.IO message `log` from `gadget-drone` to `gadget-code:backend`, which will forward the log message directly to [ChatSessionView](../gadget-code/frontend/src/pages/ChatSessionView.tsx) for display in [LogPanel](../gadget-code/frontend/src/components/LogPanel.tsx).
|
|
|
|
I have already added the `LogMessage` type to the drone message definitions, and added definitions to the appropriate interfaces we use for extending Socket.IO. It is a fire-n-forget message (no callback, no blocking).
|
|
|
|
## How It Works
|
|
|
|
You will simply pass the parameters passed to the GadgetLog API as a message over Socket.IO to the Log panel dislay in the IDE.
|
|
|
|
## Instructions
|
|
|
|
In this session, you will:
|
|
|
|
1. Implement [GadgetLogTransportSocket](../packages/api/src/lib/log-transport-socket.ts)
|
|
2. Register it for use as a default transport on the gadget-drone logger instance
|
|
3. Implement session message routing in gadget-code:backend to forward the message to gadget-code:frontend (the IDE)
|
|
4. Deliver log messages to the Chat Session view's Log panel for display
|
|
|
|
Log messages should render as closely to the Console Transport's output as possible, matching the colors used, and style.
|
|
|
|
When you are done, you will re-write this document in the style
|
|
|
|
## References
|
|
|
|
Always search first in the project's `docs` directories for information and knowledge. Here are some starting points for this session:
|
|
|
|
- [UI Design and Style Guide](../gadget-code/docs/ui-design-guide.md)]
|
|
- [System Architecture](./architecture.md)
|
|
- [Socket Protocol](./socket-protocol.md)
|