debug output for api calls is now copy/paste friendly with srfsh. async results...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 7 Feb 2006 01:54:33 +0000 (01:54 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 7 Feb 2006 01:54:33 +0000 (01:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2994 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/network.js

index 024a36e..0208945 100644 (file)
@@ -15,25 +15,33 @@ util.network.prototype = {
        // Flag for whether the staff client should act as if it were offline or not
        'offline' : false,
 
-       'request' : function (app,name,params,f) {
+       'link_id' : 0,
 
+       'request' : function (app,name,params,f) {
                try {
-
-                       this.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
+                       var obj = this;
+                       var sparams = js2JSON(params);
+                       obj.error.sdump('D_SES','request '+app+' '+name+' '+sparams.slice(1,sparams.length-1)+
+                               '\nResult #' + (++obj.link_id) + ( f ? ' asynced' : ' synced' ) );
                        var request = new RemoteRequest( app, name );
                        for(var index in params) {
                                request.addParam(params[index]);
                        }
        
                        if (f)  {
-                               request.setCompleteCallback(f);
+                               request.setCompleteCallback(
+                                       function(req) {
+                                               obj.error.sdump('D_SES_RESULT','asynced result #' + obj.link_id + '\n\n' + 
+                                                       js2JSON(req.getResultObject()));
+                                               f(req);
+                                       }
+                               );
                                request.send(false);
-                               this.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
                                return null;
                        } else {
                                request.send(true);
                                var result = request.getResultObject();
-                               this.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
+                               this.error.sdump('D_SES_RESULT','synced result #' + obj.link_id + '\n\n' + js2JSON(result));
                                return result;
                        }