From 28604420b4c61a35f064b88271c4e6ee6453564b Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Mon, 22 Aug 2016 17:43:40 +0700
Subject: [PATCH] rapihkan log

---
 xmlout.js | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/xmlout.js b/xmlout.js
index 0fe7634..35e2d64 100644
--- a/xmlout.js
+++ b/xmlout.js
@@ -110,17 +110,17 @@ function _topupRequest(task, pendingOnConnectError) {
         if (error) {
             var rc = '68';
             var msg = 'XMLRPC Client Error: ' + error;
-            
+
             if (!pendingOnConnectError && (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH')) {
                 rc = '91';
                 msg = 'XMLRPC Client Error on connecting';
             }
 
-            callbackReport(task['requestId'], rc, msg, null, JSON.stringify(error));
+            callbackReport(task['requestId'], rc, msg, null, JSON.stringify({methodName: methodName, error: error}));
             return;
         }
 
-        logger.info('Got XMLRPC response from partner for', {response_method: methodName, response_message: value});
+        logger.info('Got XMLRPC response from partner for', {methodName: methodName, response_message: value});
 
         if (value['RESPONSECODE'] == '94') {
             logger.info('Change RC 94 to 68');
@@ -134,7 +134,9 @@ function _topupRequest(task, pendingOnConnectError) {
             value['MESSAGE'] = 'SN=' + parseSN(value['MESSAGE']) + '; ' + value['MESSAGE'];
         }
 
-        callbackReport(value['REQUESTID'], value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify(value));
+        callbackReport(
+            value['REQUESTID'], value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify({methodName: methodName, response: value})
+        );
     });
 }
 
@@ -168,7 +170,9 @@ function createServer() {
                 value['MESSAGE'] = 'SN=' + parseSN(value['MESSAGE']) + '; ' + value['MESSAGE'];
             }
 
-            callbackReport(value['REQUESTID'], value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify(value));
+            callbackReport(
+                value['REQUESTID'], value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify({methodName: 'topUpReport', msg: value})
+            );
         }
 
         callback(null, 'ACK REPORT OK');
@@ -249,12 +253,14 @@ function checkStatus(task) {
         // Results of the method response
         if (error) {
             logger.warn('Error requesting topUpInquiry: ', {err: error, params: params});
-            callbackReport(task.requestId, '68', 'Error requesting topUpInquiry: ' + error, null, JSON.stringify(error));
+            callbackReport(
+                task.requestId, '68', 'Error requesting topUpInquiry: ' + error, null, JSON.stringify({methodName: methodName, error: error})
+            );
             return;
         }
         logger.info('Method response for \'' + methodName, {response: value});
 
-        callbackReport(task.requestId, value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify(value));
+        callbackReport(task.requestId, value['RESPONSECODE'], value['MESSAGE'], null, JSON.stringify({methodName: methodName, response: value}));
     });
 }
 
-- 
1.9.0