Skip to content
Snippets Groups Projects
Commit 594301d9 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

improve per-process informational debug output about what WSAPIs are...

improve per-process informational debug output about what WSAPIs are supported, their requirements, and how they are handled (forwarded or handled locally?) - issue #460
parent 09c0b4df
No related branches found
No related tags found
No related merge requests found
......@@ -173,7 +173,17 @@ exports.setup = function(options, app) {
// load all of the APIs supported by this process
var wsapis = { };
logger.debug("registering WSAPIs:");
function describeOperation(name, op) {
var str = " " + name + " (";
str += op.method.toUpperCase() + " - ";
str += (op.authed ? "" : "not ") + "authed";
if (op.args) {
str += " - " + op.args.join(", ");
}
str += ")";
logger.debug(str);
}
fs.readdirSync(path.join(__dirname, 'wsapi')).forEach(function (f) {
// skip files that don't have a .js suffix or start with a dot
if (f.length <= 3 || f.substr(-3) !== '.js' || f.substr(0,1) === '.') return;
......@@ -202,11 +212,24 @@ exports.setup = function(options, app) {
logger.error(msg);
throw msg;
}
});
logger.debug(' ' + operation);
// debug output - all supported apis
logger.debug("WSAPIs:");
Object.keys(wsapis).forEach(function(api) {
if (options.forward_writes && wsapis[api].writes_db) return;
describeOperation(api, wsapis[api]);
});
if (options.forward_writes) {
logger.debug("forwarded WSAPIs:");
Object.keys(wsapis).forEach(function(api) {
if (wsapis[api].writes_db) {
describeOperation(api, wsapis[api]);
}
});
}
app.use(function(req, resp, next) {
var purl = url.parse(req.url);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment