Commit cd768c5e1ea856903e2536cacfe4f9e4316aced9

Authored by Adhidarma Hadiwinoto
1 parent a36ad6ecc6
Exists in master

process.env.KOMODO_MESSAGING_DO_NOT_LOG

Showing 1 changed file with 6 additions and 4 deletions Side-by-side Diff

... ... @@ -8,6 +8,8 @@ if (!process.env.KOMODO_MESSAGING_DO_NOT_LISTEN) {
8 8 require('./http-callback-handler');
9 9 }
10 10  
  11 +const DO_NOT_LOG = !!process.env.KOMODO_MESSAGING_DO_NOT_LOG
  12 +
11 13 let transport;
12 14  
13 15 const originData = {
... ... @@ -22,7 +24,7 @@ function setTransport(_transport) {
22 24 function onIncomingMessage(params) {
23 25  
24 26 if ( typeof params.partner !== 'string' || typeof params.msg !== 'string' || !params.partner.trim() || !params.msg.trim() ) {
25   - logger.verbose('Not reporting to messaging center because of invalid parameter. F68CCCD74E79');
  27 + DO_NOT_LOG || logger.verbose('Not reporting to messaging center because of invalid parameter. F68CCCD74E79');
26 28 return;
27 29 }
28 30  
... ... @@ -43,14 +45,14 @@ function onIncomingMessage(params) {
43 45 }
44 46 }
45 47  
46   - logger.verbose('MESSAGING-CLIENT-LIB: Sending report to messaging service', { qs: requestOptions.qs });
  48 + DO_NOT_LOG || logger.verbose('MESSAGING-CLIENT-LIB: Sending report to messaging service', { qs: requestOptions.qs });
47 49 request(requestOptions, function(err, res, body) {
48 50 if (err) {
49 51 logger.warn('MESSAGING-CLIENT-LIB: error on request to messaging service', {err: err});
50 52 return;
51 53 }
52 54  
53   - logger.verbose('MESSAGING-CLIENT-LIB: Got resposnse', { body });
  55 + DO_NOT_LOG || logger.verbose('MESSAGING-CLIENT-LIB: Got resposnse', { body });
54 56  
55 57 if (params.do_not_forward_to_core) return;
56 58 if (params.is_outgoing) return;
... ... @@ -60,7 +62,7 @@ function onIncomingMessage(params) {
60 62 }
61 63 catch(e) {
62 64 if (DEBUG_ON_NON_JSON_DIRECT_RESPONSE) {
63   - logger.verbose('MESSAGING-CLIENT-LIB: direct response from messaging service is not on JSON format, forwarding raw response', {
  65 + DO_NOT_LOG || logger.verbose('MESSAGING-CLIENT-LIB: direct response from messaging service is not on JSON format, forwarding raw response', {
64 66 partner: params.partner,
65 67 msg: params.msg.trim(),
66 68 directResponse: body,