From 536fc0223d0de2be5b962ba6f890caa87c73b7c4 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <adhisimon@gmail.com>
Date: Mon, 7 Feb 2022 15:18:29 +0700
Subject: [PATCH] Add global.SDK_PUSH_TRX_DEBUG_ALL_GATEWAYS_FROM_CONFIG

---
 lib/client/index.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/client/index.js b/lib/client/index.js
index 9a7b665..a2e5686 100644
--- a/lib/client/index.js
+++ b/lib/client/index.js
@@ -5,15 +5,24 @@ const logger = require('tektrans-logger');
 const uniqid = require('uniqid');
 const connect = require('./connect');
 
+const debugAllGatewaysFromConfig = global.SDK_PUSH_TRX_DEBUG_ALL_GATEWAYS_FROM_CONFIG
+    || false;
+
 const connectAll = (xidFromCaller) => {
     const xid = xidFromCaller || uniqid();
 
     const gateways = config.gateways
         .filter((gateway) => !gateway.disabled && gateway.url && gateway.name);
 
-    logger.debug(`${MODULE_NAME} 79B5FEB5: Connecting to all gateways`, {
+    if (debugAllGatewaysFromConfig) {
+        logger.verbose(`${MODULE_NAME} 80C7AAD6: Dumping config.gateways`, {
+            xid,
+            gateways: config.gateways,
+        });
+    }
+
+    logger.verbose(`${MODULE_NAME} 79B5FEB5: Connecting to all gateways`, {
         xid,
-        configGateways: config.gateways,
         gatewayNames: gateways.map((gateway) => gateway.name),
     });
 
-- 
1.9.0