๐ŸŒ Log Server ๐Ÿš€

January 25, 2025 ยท View on GitHub

Log Server is a Visual Studio Code extension that provides a lightweight ๐ŸŒŸ HTTP server to receive and display logs ๐Ÿ“œ from a React Native app (or any other source that can send requests via HTTP) directly within VS Code. This extension is designed to streamline debugging ๐Ÿ” and improve development efficiency by centralizing logs in a dedicated view. ๐ŸŽฏ

๐ŸŽจ Icon credit: svgrepo


โœจ Features

  • ๐Ÿ–ฅ๏ธ Log Server: Start an HTTP server to receive logs from your React Native app.
  • ๐Ÿ“ฑ Device Filtering: Filter logs by platform and device name.
  • ๐Ÿ” Webview Log Display: Logs are displayed in a clean, scrollable Webview with:
    • ๐Ÿ“œ Word wrap for long messages.
    • ๐ŸŽจ Color-coded log levels (Info, Warn, Error).
    • ๐Ÿ”„ Autoscroll functionality if you are at the end of the log list.
  • โšก Quick Device Selection: Choose a device from the status bar for filtering logs.
  • ๐Ÿ” Search and Filter: Search logs by query and filter by log level.
  • ๐Ÿ“‹ Copy Logs: Copy log messages to the clipboard in JSON format.

๐Ÿ“‹ Requirements

To use this extension:

  1. โœ… Ensure your app can send logs as structured JSON payloads via HTTP POST requests.
    • Logs should be sent as a POST request to http://<server_ip/localhost>:19000/logs.
  2. ๐Ÿ“ The log payload format must include:
{
    "level": "Info|Warn|Error",
    "message": "Log message here",
    "platform": "iOS|Android",
    "device_name": "Device Name",
    "timestamp": "2023-01-01T12:00:00.000Z"
}

๐Ÿ› ๏ธ Note: To check if the server is running, send a GET request to http://<server_ip/localhost:19000/ping.


๐Ÿš€ Usage

๐Ÿ” Search / Filter

The syntax for searching and filtering logs is as follows:

  • Normal search: Enter a search query to filter logs by message content.
  • Log level filter: Use Info:<query>, Warn:<query>, or Error:<query> to filter logs by level and message content.

Inside the search input:

  • Enter to keep the filter and close the search input.
  • Esc to clear the filter and close the search input.

โŒจ๏ธ Hotkeys

  • Webview/Panel:
    • Ctrl + F to toggle the search input (Note: The filter will not be cleared).
    • Ctrl + D to select the device.

โš™๏ธ Extension Settings

This extension currently does not expose any configurable settings. Future releases may include additional customization options. ๐Ÿ”ง


โš ๏ธ Known Issues

๐Ÿšซ None


๐Ÿ“ Release Notes

๐Ÿ†• 0.0.1

  • Initial release of Log Server. ๐ŸŽ‰
  • Features:
    • Start and stop log server. ๐Ÿ›‘โ–ถ๏ธ
    • Display logs in a Webview with device filtering and autoscroll. ๐Ÿ”„
    • Status bar integration for quick device selection. ๐Ÿ–ฑ๏ธ

๐Ÿ”ง 0.0.2

  • Features:

    • Added to view/title two buttons to start/stop the server and clear the logs. ๐Ÿงนโน๏ธ
  • Enhancements:

    • Added more space after the last log entry. ๐Ÿ“

๐Ÿ†• 0.0.3

  • Features:
    • Added support for filtering logs by search query and log level. ๐Ÿ”
    • Added support for copying log messages to the clipboard in JSON format. ๐Ÿ“‹
    • If the port is already in use, the extension will check the next 10 ports before giving up. ๐Ÿ›‘
    • New hotkeys inside the webview/panel.โšก
      • Ctrl + F to toggle search input.
      • Ctrl + D to select the device.
    • Hotkeys when the search input is focused. โŒจ๏ธ
      • Enter to keep the filter and close the search input.
      • Esc to clear the filter and close the search input.
  • Enhancements:
    • Removed the clear logs button if the server is not running. ๐Ÿšซ๐Ÿงน
    • Improved visual styling of the webview/panel. The colors now adapt to the theme. ๐ŸŽจ