Log Analyzer Pro
A high-performance VS Code extension for viewing multi-gigabyte log files without freezing the editor.
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ VS Code UI │────▶│ TypeScript │────▶│ Rust Binary │
│ (Webview) │◀────│ Extension │◀────│ (log-core) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
HTML/JS JSON-RPC mmap/fast I/O
Components
- Frontend (Extension): TypeScript code using VS Code's
CustomReadonlyEditorProvider API
- Backend (Sidecar): Rust binary spawned as a child process for high-performance file operations
- Communication: JSON-RPC style messages over stdin/stdout
Why Rust?
- Memory-mapped I/O: Opens files instantly regardless of size using
mmap
- Zero-copy operations: Reads file data without unnecessary copies
- Parallel processing: Can leverage all CPU cores for indexing
- No GC pauses: Consistent performance without garbage collection hiccups
Project Structure
/
├── extension/ # VS Code extension (TypeScript)
│ ├── src/
│ │ ├── extension.ts # Extension entry point
│ │ ├── rustClient.ts # Rust process communication
│ │ └── logEditorProvider.ts # Custom editor provider
│ ├── bin/ # Built Rust binary (gitignored)
│ └── package.json
│
├── core/ # Rust backend
│ ├── src/
│ │ └── main.rs # Main loop and command handlers
│ └── Cargo.toml
│
└── README.md
Development Setup
Prerequisites
Build
# Install npm dependencies
cd extension
npm install
# Build the Rust binary
npm run build:rust
# Compile TypeScript
npm run compile
# Or build everything at once
npm run build:all
Running & Debugging
- Open this folder in VS Code
- Press
F5 to launch the Extension Development Host
- Open any
.log or .txt file - it will open with Log Analyzer Pro
- Click "Load Info" to test the Rust backend connection
Build Scripts
| Script |
Description |
npm run compile |
Compile TypeScript |
npm run watch |
Watch mode for TypeScript |
npm run build:rust |
Build Rust binary (release) |
npm run build:rust:debug |
Build Rust binary (debug) |
npm run build:all |
Build everything |
Protocol
Communication uses newline-delimited JSON over stdin/stdout.
{
"id": 1,
"method": "open_file",
"params": { "path": "/path/to/file.log" }
}
{
"id": 1,
"result": { "success": true, "file_size": 1234567 }
}
Or on error:
{
"id": 1,
"error": "File not found"
}
Available Commands
| Method |
Params |
Description |
ping |
none |
Health check |
open_file |
{ path: string } |
Open a file with mmap |
read_lines |
{ start_line: number, count: number } |
Read lines from file |
shutdown |
none |
Gracefully stop the backend |
Roadmap
- [ ] Build line index on file open
- [ ] Virtual scrolling for millions of lines
- [ ] Search with regex
- [ ] Line filtering
- [ ] Syntax highlighting for common log formats
- [ ] Follow mode (tail -f)
- [ ] Multi-file support
- [ ] Bookmarks
License
MIT