Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>ConditionalLoggerNew to Visual Studio Code? Get it now.
ConditionalLogger

ConditionalLogger

Rahul Thummar

|
7 installs
| (0) | Free
Automatically inserts console.log() statements inside conditional blocks like if, else, and switch to make debugging faster and easier.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

ConditionalLogger

ConditionalLogger is a lightweight VS Code extension that helps developers debug conditional logic more easily by automatically inserting console.log() statements inside:

  • if
  • else
  • else if
  • switch
  • case
  • default blocks

✨ Features

  • Quickly debug logic flow
  • Auto-inserts logs into selected conditional code
  • Handles multi-line and nested conditionals using AST
  • Adds line numbers to log messages
  • Works on JavaScript and TypeScript

🧠 How to Use

  1. Select a block of conditional code (e.g., if, else, switch).
  2. Press Alt+L.
  3. The extension will insert console.log() statements inside each conditional block.

🔧 Example

Before:


if (user.age > 18) {
  grantAccess();
} else {
  denyAccess();
}

After pressing Alt+Shift+D:

if (user.age > 18) {
  console.log("Entered if block at line 1");
  grantAccess();
} else {
  console.log("Entered else block at line 4");
  denyAccess();
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft