A VS Code / Cursor extension that adds expression-based line highlighting for log files. Open the LogLighter sidebar tab, configure regex patterns and colors, and matching lines in the current log file are highlighted.
- Sidebar tab: A dedicated "LogLighter" tab in the primary sidebar to configure highlighting.
- File pattern: Choose which files are treated as log files (default
*.log). Supports globs like**/logs/*.log. - Expression list: Add expressions with a regex pattern, foreground color, and background color. First match wins per line.
- Settings: Configuration is stored in VS Code settings (workspace:
.vscode/settings.jsonor user settings).
- Go to the Releases page of this repository.
- Download the latest
.vsixfile from the release assets. - In VS Code or Cursor: Extensions view → ⋯ (menu) → Install from VSIX… → select the downloaded
.vsixfile. - Reload the window if prompted. The LogLighter tab will appear in the sidebar.
If no release is available or you want to build from the latest code. (Tested with Node 24.)
-
Clone the repository
git clone https://github.com/stdout-se/LogLighter.git cd LogLighter -
Activate Node 24 (if using nvm)
nvm install 24 nvm use 24
If Node 24 is already installed:
nvm use 24. -
Install dependencies and build
npm install npm run compile
-
Package the extension (requires vsce)
npx @vscode/vsce package
This produces a
.vsixfile in the project root. -
Install the VSIX
In VS Code/Cursor: Extensions → ⋯ → Install from VSIX… → choose the generated.vsixfile.
For detailed packaging steps (including prerequisites and what gets included), see PACKAGING.md.
Open a file that matches your file pattern (e.g. *.log), open the LogLighter tab in the sidebar, add an expression (e.g. pattern ERROR, choose a color), and matching lines will be highlighted.
- File pattern (
loglighter.filePattern): Glob for log files. Examples:*.log,**/logs/*.log,*.txt. - Expressions (
loglighter.expressions): Array of{ id?, pattern, foreground, background }. Colors are hex (e.g.#ff0000).
You can edit these in the Settings UI or in settings.json.
- Literal words:
ERROR,WARN,INFO,DEBUG - Full line match:
^\\d{4}-\\d{2}-\\d{2}.*ERROR - Word boundary:
\\bERROR\\b - Anchors: Use
^and$yourself; the extension does not add them.
Invalid regex is skipped for highlighting and shown with a red border in the sidebar.
- Open this folder in VS Code or Cursor.
- Press F5 (or use Run → Start Debugging) to launch the Extension Development Host.
- In the new window, open the LogLighter tab in the sidebar (activity bar icon).
- Open a file that matches your file pattern (e.g.
*.log) and configure expressions to see line highlighting.
To see where time is spent when the LogLighter tab loads, enable LogLighter: Profiling in settings (loglighter.profiling: true). Timings are written to the LogLighter output channel (View → Output → select "LogLighter"). You get:
- resolveWebviewView total – time for the whole resolve (including building HTML).
- _getHtml total and per-step breakdown: reading
style.css,script.js,index.html, reading config, and the replace/inline step. - webview script+render – time in the webview from script start until the expression list is rendered (reported when the webview sends it back).
Turn profiling off when you are done; it adds a small overhead and log volume.
Unit tests use Mocha. Run them with:
npm testThis compiles the project and runs tests in src/test/. Node 14+ is required to run tests (the compiled code uses modern syntax). The tests cover types (defaults, ensureExpressionId, isTransparentBackground) and file pattern matching (matchFilePattern).
LogLighter uses only the public VS Code extension API and works in Cursor. Install the VSIX or run the extension from source (F5) in Cursor the same way as in VS Code.
- "No composite descriptor found for workbench.view.extension.loglighter" — The host (VS Code/Cursor) may log this when the LogLighter view is used. It comes from the workbench's internal view registration; the extension's
package.jsonfollows the standard view container + webview view pattern. The view typically works; this is a host-side message with no extension-level fix. - "Found unexpected service worker controller" in the LogLighter webview — The host's webview runtime may report a service worker from another webview instance (e.g. after opening multiple webviews or restoring the window). The extension does not register any service worker. The panel usually loads correctly after the host waits for the expected controller; no change is required in the extension.
This project is licensed under the GNU GPLv3. See the LICENSE file for details.
