Merge pull request +13023 from c9/vfs-debugging

Debugging VFS Save errors
pull/284/head
Tim Robinson 2016-04-07 16:07:57 -04:00
commit 2b69119d51
6 zmienionych plików z 99 dodań i 2 usunięć

Wyświetl plik

@ -109,6 +109,7 @@ module.exports = function(options) {
// VFS
"plugins/c9.vfs.client/vfs.ping",
"plugins/c9.vfs.client/vfs.log",
{
packagePath: "plugins/c9.vfs.client/vfs_client",
debug: debug,

Wyświetl plik

@ -67,7 +67,7 @@
"c9.ide.language.javascript.infer": "#18acb93a3a",
"c9.ide.language.jsonalyzer": "#4b329741b1",
"c9.ide.language.codeintel": "#2b18c5ccb1",
"c9.ide.collab": "#728ad2bde2",
"c9.ide.collab": "#33263e74c3",
"c9.ide.local": "#10eb45842a",
"c9.ide.find": "#e33fbaed2f",
"c9.ide.find.infiles": "#c0a13737ef",
@ -108,7 +108,7 @@
"c9.ide.run": "#6bd4996a4e",
"c9.ide.run.build": "#0598fff697",
"c9.ide.run.debug.xdebug": "#9956689819",
"c9.ide.save": "#4cda35bfdb",
"c9.ide.save": "#25a63f31e2",
"c9.ide.scm": "#637a68cd04",
"c9.ide.terminal.monitor": "#affa33572f",
"c9.ide.test": "#102942ae4e",

Wyświetl plik

@ -0,0 +1,10 @@
module.exports = function(vfs, options, register) {
register(null, {
log: function (message, callback) {
callback = callback || function(){};
console.log(message);
callback();
}
})
}

Wyświetl plik

@ -0,0 +1,82 @@
/** Sends client side logs to vfs via the websocket connection **/
define(function (require, exports, module) {
"use strict";
main.consumes = ["Plugin", "ext", "c9"];
main.provides = ["vfs.log"];
return main;
function main(options, imports, register) {
var Plugin = imports.Plugin;
var c9 = imports.c9;
var ext = imports.ext;
var plugin = new Plugin("Ajax.org", main.consumes);
var loaded = false;
var server = null;
function load() {
if (loaded) return false;
loaded = true;
ext.loadRemotePlugin("log", {
code: require("text!./log-service.js"),
redefine: true
}, function(err, remote) {
if (err) return console.error(err);
server = remote;
});
c9.on("stateChange", function(e) {
if (e.state & c9.NETWORK) {
load();
}
else {
loaded = false;
server = null;
}
}, plugin);
}
function log() {
if (!server) return console.error("Cannot log, client is offline");
var callback = function(){};
var args = Array.prototype.slice.call(arguments);
if (typeof args[args.length-1] === "function") {
callback = args.splice(args.length-1, 1);
}
var message = "";
args.forEach(function (arg) {
if (typeof arg === "object") {
return message += JSON.stringify(arg);
}
message += arg;
});
server.log(message, callback);
}
plugin.on("load", function() {
load();
});
plugin.on("unload", function() {
loaded = false;
server = null;
});
plugin.freezePublicAPI({
log: log
});
register(null, {
"vfs.log": plugin
});
}
})

Wyświetl plik

@ -146,6 +146,7 @@ define(function(require, exports, module) {
function rest(path, options, callback) {
if (!vfs || !connection || connection.readyState != "open") {
console.error("[vfs-client] Cannot perform rest action for ", path, " vfs is disconnected");
var stub = { abort: function(){ buffer[this.id]= null; } };
stub.id = buffer.push([path, options, callback, stub]) - 1;
return stub;

Wyświetl plik

@ -94,6 +94,9 @@ require([
var x = new EventEmitter();
return x;
})(),
"vfs.log": {
log: function(){}
},
anims: (function(){
var x = new EventEmitter();
x.animateSplitBoxNode = function(node, opt) {