
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 08:26 AM
I use console.warn() everywhere in client scripts. It really helps debugging, especially because .warn() stands out so wonderfully.
Example:
I'm not a fan of the 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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2021 10:45 AM
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:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 08:51 AM
Unfortunately, I've not seen anything native to ServiceNow that encompasses this type of logging. I, too, use console.warn() and console.error() to make certain statements stand out in the console, but using chrome and the developer tools I haven't noticed anything "unexpected console statement" messages.
The only client-side function I see anywhere for logging is jslog(), which I use primarily when I need to evaluate something using ServiceNow's console.
Wish I had a better answer!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2020 06:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 08:52 AM
May be ypu can try this
const style = 'font-weight: bold; font-size: 50px;color: red; text-shadow: 3px 3px 0 rgb(217,31,38) , 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) , 15px 15px 0 rgb(2,135,206) , 18px 18px 0 rgb(4,77,145) , 21px 21px 0 rgb(42,21,113)';
console.log('%c Rainbowww!', style);
console.log(' Test Comments', 'background: #222; color: #bada55');
console.log("HELLO-11111");
console.log('%c Oh my heavens! ', 'background: #415; color: #bada65');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 09:07 AM
Ok. That's pretty cool! Maybe wrapped in a function and made as part of a global ui script...neat.
Michael D. Jones
Proud member of the GlideFast Consulting Team!