DnT Log Viewer Extension
A VSCode extension for viewing and analyzing log files with advanced filtering capabilities.
Features
- Multiple Log Format Support: Supports Loguru and custom log formats
- Hierarchical Filtering: Filter logs by level with automatic higher-priority inclusion
- Syntax Highlighting: Color-coded log levels for easy identification
- Interactive UI: Click-to-filter with real-time statistics
- Multiple Access Methods: Right-click menus, editor integration, and command palette
Setup and Testing
1. Install Dependencies
npm install
2. Compile TypeScript
npm run compile
3. Test the Extension
- Open this folder in VSCode
- Press
F5 or go to Run > Start Debugging
- This will open a new "Extension Development Host" window
- In the new window, create or open a
.log file
- Right-click on the
.log file in the explorer
- Select "Open DnT Log Viewer" from the context menu
4. Sample Log File for Testing
Create a test file sample.log with content like:
11:41:04 | DEBUG - Turning on Power.
11:41:06 | DEBUG - Power supply - Current: 0.4930 A.
11:41:07 | INFO - System initialized successfully.
11:41:08 | WARNING - Temperature threshold exceeded.
11:41:09 | ERROR - Connection failed, retrying...
11:41:10 | CRITICAL - System shutdown initiated.
Usage
Access Methods
- Right-click any
.log file in the VSCode explorer
- Right-click inside an open
.log file in the editor
- Click the DnT Log Viewer icon in the editor title bar
- Command Palette:
Ctrl+Shift+P → "DnT Log Viewer: Open Log File"
Filtering Features
- Hierarchical Mode (Default): Clicking a log level shows that level and all higher priority levels
- Toggle Mode: Individual level filtering
- Quick Filters: Show All, Hide All, Errors Only buttons
- Real-time Statistics: Live count of total and visible entries
Log Level Priority
TRACE < DEBUG < INFO < SUCCESS < WARNING < ERROR < CRITICAL
The extension automatically detects and parses various log formats:
- Loguru default format
- Custom timestamp formats
- Bracketed timestamps
- Various separator styles
Development
Built with TypeScript and designed for extensibility. The parser can be easily extended to support additional log formats.
| |