Epic Logger
Epic Logger is a small Visual Studio Code extension that helps you quickly insert and remove console logs for variables, function parameters, objects, and expressions. It includes an optional ISO timestamp and internally tags inserted logs so they can be targeted for removal.
NOTE HEAVY WIP BASICALLY A PROTOTYPE
Features
- Insert a
console.log
for the selected variable or the word under the cursor.
- Optionally include an ISO timestamp in generated messages.
- Mark inserted logs with an internal marker so the extension can remove only the logs it added.
- Remove previously inserted logs (by emoji/marker) from the active document.
Commands
Epic Logger: Log Variable
(epicLogger.logVariable
) — insert a console.log
for the current selection or word under the cursor.
Epic Logger: Remove Inserted Logs
(epicLogger.removeLogs
) — remove console statements that were inserted by Epic Logger (identified by an internal marker).
Epic Logger World
(epicLogger.helloWorld
) — example/test command included with the extension.
You can run these from the Command Palette (Ctrl+Shift+P) or via the editor/context menu.
Configuration
Epic Logger exposes one setting (configured in VS Code settings):
epicLogger.includeTimestamp
(boolean, default: false
)
- When enabled, Epic Logger prepends an ISO timestamp to generated log messages.
Set them in your user or workspace settings (File → Preferences → Settings) or in your settings.json
:
{
"epicLogger.includeTimestamp": true
}
Quick start
- Open a source file and select a variable or place the cursor on a variable name.
- Open Command Palette (Ctrl+Shift+P) →
Epic Logger: Log Variable
.
- A
console.log
line is inserted below the selection, e.g.:
console.log("💜 myVar:", myVar);
- If
epicLogger.includeTimestamp
is enabled the message will include an ISO timestamp.
- To remove inserted logs, run
Epic Logger: Remove Inserted Logs
from the Command Palette while the editor has focus.
Development
Install dependencies and build locally:
pnpm install
pnpm run compile
Watch mode (rebuilds on change):
pnpm run watch
Run unit and integration tests:
pnpm run test:unit
pnpm run test:integration
The extension entry point is ./src/extension.ts
and the built artifact is ./dist/extension.js
.
Publishing
Before publishing, ensure package.json
contains a publisher
field and the version
has been bumped.
- Create a publisher in the Visual Studio Marketplace and generate a Personal Access Token (PAT) for publishing.
- Package the extension into a .vsix file:
npx vsce package
- Publish (either set
VSCE_PAT
env or pass --pat
):
export VSCE_PAT="<your-pat>"
npx vsce publish patch
Alternatively publish to Open VSX with ovsx
.
Troubleshooting
- If commands don't appear in the Command Palette, make sure the extension is activated (check
activationEvents
in package.json
) and the build artifact exists at ./dist/extension.js
.
- Run the test tasks and linter if you hit type or build issues:
pnpm run compile
and pnpm run lint
.
License
See LICENSE
(if present) for license details.
Continuous integration (integration harness)
This repository includes a GitHub Actions workflow at .github/workflows/integration.yml
that runs unit tests and the VS Code integration harness using @vscode/test-electron
on ubuntu-latest
.
To run integration tests locally (requires system GUI libs) you can use Xvfb on Linux:
# compile
pnpm run compile-tests && pnpm run compile
# run the harness inside a virtual X server
xvfb-run --auto-servernum --server-args='-screen 0 1280x1024x24' pnpm run test:integration:harness
Keyboard shortcuts
Epic Logger ships with a few sensible default keybindings. You can change or remove them from VS Code's Keyboard Shortcuts UI or by editing your keybindings.json
.
Default bindings included with the extension:
- Insert log (Epic Logger: Log Variable):
Ctrl+Alt+L
(Windows/Linux), Cmd+Alt+L
(mac)
- Toggle comments for inserted logs (Epic Logger: Comment / Uncomment Inserted Logs):
Ctrl+Alt+T
(Windows/Linux), Cmd+Alt+T
(mac)
- Remove inserted logs (Epic Logger: Remove Inserted Logs):
Ctrl+Alt+R
(Windows/Linux), Cmd+Alt+R
(mac)
How to change or remove a default binding:
- Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P) →
Preferences: Open Keyboard Shortcuts
.
- Search the command by name (for example
Epic Logger: Log Variable
).
- Click the pencil icon to set a new keybinding or the trash icon to remove/unbind the default.
You can also add an entry to your keybindings.json
to override or remove a default binding. To unbind a default binding, add a leading dash to the key, e.g.:
{
"key": "-ctrl+alt+l",
"command": "epicLogger.logVariable"
}
If you'd prefer to avoid shipping defaults, remove the contributes.keybindings
entries from package.json
and document suggested shortcuts in this README for users to add manually.