jslog.. ok, is there a jswarn method?

xiaix
Tera Guru

I use console.warn() everywhere in client scripts.  It really helps debugging, especially because .warn() stands out so wonderfully.

Example:

find_real_file.png

 

I'm not a fan of the find_real_file.png that I keep getting though.

I would use jslog() , but then I lose the color and stand out of console.warn().

Is there anything like a jswarn() ?  Or, is there a way to log to the browser's console natively from SN that I could give it some highlighting to stand out?

1 ACCEPTED SOLUTION

Trevor Muhl
Kilo Sage

If you don't mind having extra comments in your code, you can disable the ESLint rule responsible for those warnings.

Disable for one line:

/* eslint-disable-next-line no-console */

Disable for multiple lines (and then re-enable, if desired):

/* eslint-disable no-console */
... many console statements here
/* eslint-enable */

Here is a screenshot of the results:

find_real_file.png

View solution in original post

9 REPLIES 9

I'll give you a find_real_file.png click because you said: find_real_file.png

That color is badass !  lol

That'd be a ton of extra work just for some browser console highlighting, and it still doesn't solve the find_real_file.png issue from ServiceNow.

RAHUL Khanna1
Mega Guru

if that has helped can you close this thread by marking it as helpful/answered.

Trevor Muhl
Kilo Sage

If you don't mind having extra comments in your code, you can disable the ESLint rule responsible for those warnings.

Disable for one line:

/* eslint-disable-next-line no-console */

Disable for multiple lines (and then re-enable, if desired):

/* eslint-disable no-console */
... many console statements here
/* eslint-enable */

Here is a screenshot of the results:

find_real_file.png

Brilliant!

I'm marking this as the correct answer because it does exactly what I need... to stop those darn orange circles!