Client-side logging utility for ServiceNow#2525
Client-side logging utility for ServiceNow#2525tab22 wants to merge 2 commits intoServiceNowDevProgram:mainfrom
Conversation
SapphicFire
left a comment
There was a problem hiding this comment.
Thank you for your contribution. However, it is quite simlar to the existing object, jslog(), that exists, and does not work as described. It also requires changes in production to enable debug logging, as opposed to moving this logic to another record.
I will close this PR for now. I invite you to review the feedback and make updates. At that point, please feel free to either re-open this PR, or create a new one.
| 'use strict'; | ||
|
|
||
| window.Logger = (function() { | ||
| const isDebugEnabled = true; // change it to 'true' for production when needed |
There was a problem hiding this comment.
This would require a code change every time
| 2. Log levels: INFO, DEBUG, WARN, and ERROR | ||
| 3. Easily enable/disable debug mode globally | ||
| 4. Lightweight and ECMAScript 6–compliant | ||
| 5. Works in Client Scripts, UI Scripts, and Service Portal widgets |
There was a problem hiding this comment.
Based on the instructions, this does not work for any of these. If you set Global, it will not work on portal as Global are limited to desktop. When I test this creating the UI Script in the global scope, I note that the UI Script attempts to compile the interpolated variables in the string literal and so these come through as empty
|
Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one. |
PR Description:
The script defines a client-side logging utility called Logger to standardise how developers log messages across various client-side scripts.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions