From 2144c64607cf5a227be77fad6bef74340210d3a3 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Sun, 26 Oct 2025 12:38:41 +0000 Subject: [PATCH 1/3] Create DeveloperDebugUtility.js --- .../DeveloperDebugUtility.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Server-Side Components/Script Includes/Developer Debug Utility/DeveloperDebugUtility.js diff --git a/Server-Side Components/Script Includes/Developer Debug Utility/DeveloperDebugUtility.js b/Server-Side Components/Script Includes/Developer Debug Utility/DeveloperDebugUtility.js new file mode 100644 index 0000000000..b2c1ef6eb7 --- /dev/null +++ b/Server-Side Components/Script Includes/Developer Debug Utility/DeveloperDebugUtility.js @@ -0,0 +1,35 @@ +var DeveloperDebugUtility = Class.create(); +DeveloperDebugUtility.prototype = { + initialize: function() {}, + + // Checks if debug logging is enabled via system property + + _enable_debug: function() { + // System Property: enable_debug_for_scripts (true/false) + return gs.getProperty('enable_debug_for_scripts') == 'true'; + }, + + // Controlled debug logger + // {String} message - The message to log + _debug: function(message) { + if (this._enable_debug()) { + gs.info('[DEBUG LOG] ' + message); + } + }, + + // Example function where controlled debugging can be used + addFunction: function(data) { + try { + // Example logic: simulate some operation + this._debug('Executing addFunction with data: ' + JSON.stringify(data)); + + // core logic here + + this._debug('addFunction executed successfully.'); + } catch (e) { + this._debug('Error executing addFunction:\n' + e); + } + }, + + type: 'DeveloperDebugUtility' +}; From 26ad4fba6fed19a04305200f638ffa1be9328046 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Sun, 26 Oct 2025 12:41:50 +0000 Subject: [PATCH 2/3] Create README.md --- .../Developer Debug Utility/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Server-Side Components/Script Includes/Developer Debug Utility/README.md diff --git a/Server-Side Components/Script Includes/Developer Debug Utility/README.md b/Server-Side Components/Script Includes/Developer Debug Utility/README.md new file mode 100644 index 0000000000..55a9cea903 --- /dev/null +++ b/Server-Side Components/Script Includes/Developer Debug Utility/README.md @@ -0,0 +1,16 @@ +# Developer Debug Utility (Controlled Logging) +Create a systemProperty - enable_debug_for_scripts (Boolean value) + +# Overview +This utility provides a centralized, configurable debug logging mechanism** for developers. +Instead of using gs.info(), gs.log(), or gs.warn() - which create permanent logs in the system, developers can now log messages conditionally through a system property. + +When the property 'enable_debug_for_scripts' is set to 'true', debug messages are logged; otherwise, all debug calls are ignored. +This makes it ideal for debugging issues in Production without modifying code or flooding system logs. + + +# Objective +To provide a reusable, lightweight debugging utility that allows developers to: +- Enable/disable debug logs globally via a system property. +- Avoid unnecessary system log entries when debugging is not needed. +- Maintain clean, controlled, and consistent debug output across server-side scripts. From ddde61edfa51cb54dcc458f6ccf5438366325f96 Mon Sep 17 00:00:00 2001 From: sanjaykumar3sn Date: Sun, 26 Oct 2025 12:42:18 +0000 Subject: [PATCH 3/3] Update README.md --- .../Script Includes/Developer Debug Utility/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server-Side Components/Script Includes/Developer Debug Utility/README.md b/Server-Side Components/Script Includes/Developer Debug Utility/README.md index 55a9cea903..e9a6473e88 100644 --- a/Server-Side Components/Script Includes/Developer Debug Utility/README.md +++ b/Server-Side Components/Script Includes/Developer Debug Utility/README.md @@ -2,7 +2,7 @@ Create a systemProperty - enable_debug_for_scripts (Boolean value) # Overview -This utility provides a centralized, configurable debug logging mechanism** for developers. +This utility provides a centralized, configurable debug logging mechanism for developers. Instead of using gs.info(), gs.log(), or gs.warn() - which create permanent logs in the system, developers can now log messages conditionally through a system property. When the property 'enable_debug_for_scripts' is set to 'true', debug messages are logged; otherwise, all debug calls are ignored.