Yes more debug logging.

This commit is contained in:
Kenton Varda committed 2015-12-08 11:22:42 -08:00
1 parent 963dc37a1b
commit d6a93a7ff4
2 files changed
+29 -2

No files matched your search

+12
View File
@@ -2456,6 +2456,17 @@ v8::Handle<v8::Value> enableVerboseDebugLogging(const v8::Arguments& args) {
});
}
v8::Handle<v8::Value> methodName(const v8::Arguments& args) {
// methodName(method) -> string
KJV8_UNWRAP(CapnpContext, context, args.Data());
KJV8_UNWRAP(capnp::InterfaceSchema::Method, method, args[0]);
return liftKj([&]() -> v8::Handle<v8::Value> {
return v8::String::NewSymbol(method.getProto().getName().cStr());
});
}
// -----------------------------------------------------------------------------
void init(v8::Handle<v8::Object> exports) {
@@ -2502,6 +2513,7 @@ void init(v8::Handle<v8::Object> exports) {
mapFunction("throw_", throw_);
mapFunction("enableVerboseDebugLogging", enableVerboseDebugLogging);
mapFunction("methodName", methodName);
return emptyHandle;
});
+17 -2
View File
@@ -153,12 +153,23 @@ function makeMethod(cap, method) {
v8capnp.fromJs(req, Array.prototype.slice.call(arguments, 0), LocalCapWrapper);
var pipeline;
var promise = new Promise(function (resolve, reject) {
pipeline = v8capnp.send(req, resolve, reject, Capability);
pipeline = v8capnp.send(req, function (x) {
if (verboseDebugLogging) console.log("capnp.js: returned to JS 1", v8capnp.methodName(method));
resolve(x);
}, function (x) {
if (verboseDebugLogging) console.log("capnp.js: threw to JS 1", v8capnp.methodName(method), x);
reject(x);
}, Capability);
}).then(function (response) {
if (verboseDebugLogging) console.log("capnp.js: returned to JS 2", v8capnp.methodName(method));
var result = v8capnp.toJs(response, Capability);
v8capnp.release(response);
settleCaps(pipeline, result);
if (verboseDebugLogging) console.log("capnp.js: returned to JS 3", v8capnp.methodName(method));
return result;
}, function (err) {
if (verboseDebugLogging) console.log("capnp.js: threw to JS 2", v8capnp.methodName(method));
throw err;
});
makeRemotePromise(promise, pipeline);
return promise;
@@ -276,4 +287,8 @@ exports.bytesToPreorder = function(schema, buf) {
return v8capnp.toBytes(builder);
}
exports.enableVerboseDebugLogging = v8capnp.enableVerboseDebugLogging;
var verboseDebugLogging = false;
exports.enableVerboseDebugLogging = function (flag) {
verboseDebugLogging = flag;
v8capnp.enableVerboseDebugLogging(flag);
}