Make Debugging Much Easier using Turbo Console Log | VS Code | Salesforce LWC Stack ☁️⚡️

 In this blog I will show you a super productivity hack using which you can make your debugging much easier.

It's a VS Code extension. The Extension name is Turbo Console Log.

This extension make debugging much easier by automating the operation of writing meaningful log message.

Features

I) Insert meaningful log message automatically

Two steps:

Selecting the variable which is the subject of the debugging

Pressing ctrl + alt + L

The log message will be inserted in the next line relative to the selected variable like this:

console.log("SelectedVariableEnclosingClassName -> SelectedVariableEnclosingFunctionName -> SelectedVariable", SelectedVariable)

alt text


Multiple cursor support:

alt text


Properties:

turboConsoleLog.logFunction (string): Custom log function to use in the inserted log message, when specified logType property will be ignored

turboConsoleLog.logType (enum): "log","warn", "error","debug","table"

turboConsoleLog.wrapLogMessage (boolean): Whether to wrap the log message or not.

turboConsoleLog.logMessagePrefix (string): The prefix of the log message (default one is 🚀 ).

turboConsoleLog.addSemicolonInTheEnd (boolean): Whether to put a semicolon in the end of the log message or not.

turboConsoleLog.insertEnclosingClass (boolean): Whether to insert or not the enclosing class of the selected variable in the log message.

turboConsoleLog.insertEnclosingFunction (boolean): Whether to insert or not the enclosing function of the selected variable in the log message.

turboConsoleLog.delemiterInsideMessage (string): The delimiter that will separate the different log message elements (file name, line number, class, function and variable)

turboConsoleLog.includeFileNameAndLineNum (boolean): Whether to include the file name and the line number of the log message.

turboConsoleLog.quote (enum): Double quotes (""), single quotes ('') or backtick(``).

A wrapped log message :
alt text


II) Comment all log messages, inserted by the extension, from the current document

All it takes to comment all log messages, inserted by the extension, from the current document is to press alt + shift + c
alt text

III) Uncomment all log messages, inserted by the extension, from the current document

All it takes to uncomment all log messages, inserted by the extension, from the current document is to press alt + shift + u
alt text

IV) Delete all log messages, inserted by the extension, from the current document

All it takes to delete all log messages, inserted by the extension, from the current document is to press alt + shift + d
alt text


Checkout complete video tutorial below

 If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks
Happy Coding :)

Post a Comment

0 Comments