๐ 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:
- โ
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.
- Logs should be sent as a POST request to
- ๐ 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>, orError:<query>to filter logs by level and message content.
Inside the search input:
Enterto keep the filter and close the search input.Escto clear the filter and close the search input.
โจ๏ธ Hotkeys
- Webview/Panel:
Ctrl + Fto toggle the search input (Note: The filter will not be cleared).Ctrl + Dto 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 + Fto toggle search input.Ctrl + Dto select the device.
- Hotkeys when the search input is focused. โจ๏ธ
Enterto keep the filter and close the search input.Escto 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. ๐จ