Tips to effectively use Google chrome developer tool

While building Lightning Components in Salesforce, how to effectively use Google chrome developer tools to troubleshoot and analyze issue

Web based applications are dominating the software industry and various frameworks like Angular 2, React, polymer and Lightning are on rise. From movie Spider man, this dialogue stands very true – With great power comes great responsibility.

As a web developer, its our job to make sure the application implemented by us, stands on performance benchmark and at the same time development time is reduced. To achieve this, fast and effective troubleshooting of web application becomes integral part of project development. One of the best tool to troubleshoot web applications are available freely – Google chrome developer tools.

In this blog post, we will uncover lots of tips and tricks about using chrome developer tools.

To launch, chrome developer tools in chrome, use shortcut ctrl+shift+I or ctrl+shift+J. We can directly execute Javascript in chrome dev tools without creating any html or javascript file.

Console API

we will start with console API of chrome developer tool first.

Printing Debug statements in Javascript

we can use various methods of console in javascript to debug our code. Previously, if we wanted to debug JavaScript, alert methods were mostly used however they were very annoying. Below code snippet shows available methods to print debug statements in chrome console.

<script> 
	console.error('Google chrome dev tools - error');
	console.warn('Google chrome dev tools - warn'); 
	console.info('Google chrome dev tools - info'); 
	console.debug('Google chrome dev tools - debug'); 
	console.log('Google chrome dev tools - log');  
</script>

Below is output, how its displayed in chrome

Console.log levels
Console.log levels

As shown in above image, different log levels of console method printed in different color. error log level even prints complete stack trace of methods showing origin of error.

Continue reading “Tips to effectively use Google chrome developer tool”

Change Style of Console.log debug statements in JavaScript

Applying css style to console.log statements in JavaScript

Most of web developers or Salesforce Lightning Component developers are working on JavaScript. If they run into any issue and in need of debugging mechanism then Console.log is always there to rescue. Imagine your application has many debug statements and some of them are very important for problem solving, wouldn’t it be nice, if those statements can stand out from others ?

Recently, I noticed something amazing in Facebook console when I pressed “Ctrl+Shift+J” (Developer tools) as shown in below image.

Changed Style of Console.log in Facebook
Changed Style of Console.log in Facebook

Continue reading “Change Style of Console.log debug statements in JavaScript”

Top Google chrome extensions for Salesforce

Checkout if your favorite Google Chrome extension made it in Top extensions for Salesforce

1. Salesforce Developer Tool Suite

First in my list is “Salesforce Developer Tool Suite” by concret.io.

Does it takes a lot to view debug logs i.e. via setup area or dev console. This extension is an attempt to make this use case simple, by making debug logs visible in 2 clicks, without leaving the current Salesforce tab. Plus, you get a better hierarchical view of debug logs, which are better to analyse.

I have lots of expectation from this extension as this is the one of extension which takes feedback actively (You can find discussion tab just inside app) and frequently releases new capabilities. More features, like Execute Anonymous, Code Coverage, Test Cases are in pipe, will be released soon.

Chrome extension - Salesforce Developer Tool Suite
Chrome extension – Salesforce Developer Tool Suite

install it from here. you can find more about this extension on company blog page.

2. Salesforce Navigator

Second in my list is “Salesforce Navigator” and I cant live without it a single day. On average, it saves more than 50% of my clicks needed for administration. My shortcut for this utility is “Ctrl + Alt + Space” and I guess this most used combination on my system. Using this utility, you can directly navigate to any setup page like Object, Apex class, Pages, Workflow rule etc.

Salesforce Navigator - Google Chrome extension
Salesforce Navigator – Google Chrome extension

install it from here. Continue reading “Top Google chrome extensions for Salesforce”