Log Stripper
Remove debug, log, and print statements from 20+ languages before you ship. Preview what will be deleted, highlight lines without changing the file, or clean an entire workspace in one pass.
Install from Marketplace: search Log Stripper by saurabhchoudhary, or install the .vsix locally.
Quick start
- Open a source file (JavaScript, Python, Go, etc.).
- Press
Ctrl+Shift+D (Cmd+Shift+D on Mac) to preview and strip the current file.
- Press
Ctrl+Shift+H to toggle debug highlights on or off (same shortcut turns them off).
Features
| Feature |
How to run |
| Preview and strip current file |
Ctrl+Shift+D / Cmd+Shift+D |
| Toggle debug highlights |
Ctrl+Shift+H / Cmd+Shift+H (press again to turn off) |
| Clear debug highlights |
Command Palette → Log Stripper: Clear Debug Highlights, or toolbar eye-closed icon |
| Strip current file |
Command Palette → Log Stripper: Strip Current File, or right-click in editor |
| Strip entire workspace |
Command Palette → Log Stripper: Strip Entire Workspace, or right-click in Explorer |
| List supported languages |
Command Palette → Log Stripper: Show Supported Languages |
Supported languages
| Language |
Examples of what gets removed |
| JavaScript / TypeScript |
console.log, console.debug, debugger, etc. |
| Vue / Svelte / React (JSX/TSX) |
Same as JS/TS |
| Python |
print(), logging.debug(), breakpoint(), pdb.set_trace() |
| Java |
System.out.println, logger.debug, printStackTrace() |
| Kotlin |
println(), Log.d(), logger.* |
| Swift |
print(), NSLog(), debugPrint() |
| Dart / Flutter |
print(), debugPrint(), developer.log() |
| Ruby |
puts, pp, Rails.logger.*, binding.pry |
| PHP |
echo, var_dump(), dd(), dump() |
| Go |
fmt.Print*, log.Fatal, etc. |
| Rust |
println!, dbg!, debug!, etc. |
| C / C++ |
printf, cout <<, std::cerr, etc. |
| C# |
Console.WriteLine, Debug.Write, logger.Log* |
| Shell / Bash |
echo, printf, set -x |
| R |
print(), cat(), message() |
| Lua |
print(), io.write() |
| Scala |
println(), logger.* |
| Elixir |
IO.puts, Logger.debug |
| Haskell |
putStrLn, trace, traceShow |
How to use
Strip one file (with preview)
Ctrl+Shift+D opens a confirmation dialog listing lines that will be removed. Choose Remove All to apply.
Toggle debug highlights
Ctrl+Shift+H marks matching lines in the editor without changing the file. Press the same shortcut again to turn highlights off.
You can also use the eye icon in the editor toolbar to turn highlights on, and the eye-closed icon to turn them off.
Highlights automatically:
- Clear when you strip the file (no more red lines on wrong code)
- Update when you delete a log line while highlights are on
- Clear when you switch to another file (default; see settings below)
Strip the whole workspace
Command Palette → Log Stripper: Strip Entire Workspace.
Skips common folders (node_modules, dist, .git, vendor, build, out) by default. Always use version control or a backup first.
Settings
Open VS Code Settings and search logStripper, or add to settings.json:
{
"logStripper.autoHighlight": false,
"logStripper.confirmBeforeStrip": true,
"logStripper.clearHighlightsOnTabChange": true,
"logStripper.refreshHighlightsOnEdit": true,
"logStripper.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/.git/**",
"**/vendor/**",
"**/build/**",
"**/out/**"
]
}
| Setting |
Default |
Description |
logStripper.autoHighlight |
false |
Highlight debug lines when you switch files |
logStripper.confirmBeforeStrip |
true |
Ask before stripping via Strip Current File |
logStripper.clearHighlightsOnTabChange |
true |
Clear highlights when you open another file |
logStripper.refreshHighlightsOnEdit |
true |
Update highlights as you edit the file |
logStripper.excludePatterns |
see above |
Globs skipped during workspace strip |
Safety notes
- Only removes debug calls that are the whole statement on a line (after indentation). Inline code like
return console.log(x) is not removed.
- Comment lines (e.g.
// console.log) are kept.
- Run your tests and type-checker after a large strip (
npm test, pytest, go test, etc.).
- This tool cleans ad-hoc debug output. It does not replace proper logging libraries in production.
Install from source
git clone https://github.com/saurabhzaiswal/Log-Stripper-VS-Code.git
cd Log-Stripper-VS-Code
npm install
npm run compile
npm run package
code --install-extension log-stripper-1.0.2.vsix
Press F5 in VS Code to run the Extension Development Host.
Author
Saurabh Choudhary - developed Log Stripper as a VS Code extension with multi-language stripping, preview, highlight mode, workspace cleanup, and unit tests.
Built with TypeScript and the VS Code Extension API.
| |