Commit 536fc0223d0de2be5b962ba6f890caa87c73b7c4

Authored by Adhidarma Hadiwinoto
1 parent 4c3d2b1cee
Exists in master

Add global.SDK_PUSH_TRX_DEBUG_ALL_GATEWAYS_FROM_CONFIG

Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff

... ... @@ -5,15 +5,24 @@ const logger = require('tektrans-logger');
5 5 const uniqid = require('uniqid');
6 6 const connect = require('./connect');
7 7  
  8 +const debugAllGatewaysFromConfig = global.SDK_PUSH_TRX_DEBUG_ALL_GATEWAYS_FROM_CONFIG
  9 + || false;
  10 +
8 11 const connectAll = (xidFromCaller) => {
9 12 const xid = xidFromCaller || uniqid();
10 13  
11 14 const gateways = config.gateways
12 15 .filter((gateway) => !gateway.disabled && gateway.url && gateway.name);
13 16  
14   - logger.debug(`${MODULE_NAME} 79B5FEB5: Connecting to all gateways`, {
  17 + if (debugAllGatewaysFromConfig) {
  18 + logger.verbose(`${MODULE_NAME} 80C7AAD6: Dumping config.gateways`, {
  19 + xid,
  20 + gateways: config.gateways,
  21 + });
  22 + }
  23 +
  24 + logger.verbose(`${MODULE_NAME} 79B5FEB5: Connecting to all gateways`, {
15 25 xid,
16   - configGateways: config.gateways,
17 26 gatewayNames: gateways.map((gateway) => gateway.name),
18 27 });
19 28